Yemen's Ali Abdullah Saleh resigned Wednesday as president after almost 10 months of protests calling for him to quit, AFP reported.

Saleh has ruled the fractious desert country for three decades. He was badly wounded by a bombing at a mosque in the presidential palace in June, but returned home after three months of treatment in Saudi Arabia.

Saleh has struck a deal with the opposition that will see him leave office in 30 days. Meanwhile, Vice President Abdrabuh Mansur Hadi will negotiate details of a power transfer with the opposition, in return for a promise of immunity from prosecution.

Saleh will seek medical treatment in New York, UN Secretary General Ban Ki-moon said.

"If he comes to New York I will be happy to meet him," the Ban added, saying he was "encouraged by the positive development of the situation in Yemen." 

Saleh, a former army officer, was elected president of North Yemen by a constituent assembly after the June 1978 assassination of President Ahmad al-Ghashmi. In 1990, he led the country to reunification with the communist south.

Saleh joins the leaders of Tunisia, Egypt and Libya in the list of autocrats toppled in this year's massive Middle Eastern rebellion. Syria's Bashar Assad is widely expected to be the next leader to lose power.