SANAA, Yemen — Yemen's autocratic leader agreed Wednesday to step down after months of demonstrations against his 33-year rule, pleasing the U.S. and its Gulf allies who feared that collapsing security in the impoverished nation was allowing an active al-Qaida franchise to step up operations.
President Ali Abdullah Saleh is the fourth leader to lose power in the wave of Arab Spring uprisings this year, following longtime dictators in Tunisia, Egypt and Libya.
But the deal ushering Saleh from power grants him immunity from prosecution and doesn't explicitly ban him from the country's political life — raising doubts that it will address Yemen's many problems.
The deal opens the way to what will likely be a messy power struggle. Among those possibly vying for power are Saleh's son and nephew, who command the country's best-equipped military units; powerful tribal leaders; and the commander of a renegade battalion.
Saleh had stubbornly clung to power despite nearly 10 months of huge street protests in which hundreds of people were killed by his security forces. At one point, Saleh's palace mosque was bombed and he was treated in Saudi Arabia for severe burns. When he finally signed the agreement to step down, he did so in the Saudi capital of Riyadh after most of his allies had abandoned him and joined the opposition.
Seated beside Saudi King Abdullah and dressed smartly in a dark business suit with a matching striped tie and handkerchief, Saleh smiled as he signed the U.S.-backed deal hammered out by his powerful Gulf Arab neighbors to transfer power within 30 days to his vice president, Abed Rabbo Mansour Hadi. He then clapped his hands a few times.
"The signature is not what is important," Saleh said after signing the agreement. "What is important is good intentions and dedication to serious, loyal work at true participation to rebuild what has been destroyed by the crisis during the last 10 months."
Saleh had agreed to sign the deal three times before, only to back away at the last minute.
The power transfer will be followed by presidential elections within 90 days. A national unity government will them oversee a two-year transitional period.
The deal falls far short of the demands of the tens of thousands of protesters who have doggedly called for democratic reforms in public squares across Yemen since January, sometimes facing lethal crackdowns by Saleh's forces.
Protesters camped out in the capital of Sanaa immediately rejected the deal, chanting, "No immunity for the killer!" They vowed to continue their protests.
President Barack Obama welcomed the decision, saying the U.S. would stand by the Yemeni people "as they embark on this historic transition."
King Abdullah also praised Saleh, telling Yemenis the plan would "open a new page in your history" and lead to greater freedom and prosperity.
Saleh, believed to be in his late 60s, addressed members of the Saudi royal family and international diplomats at the signing ceremony, portraying himself as a victim who sought to preserve security and democracy but was forced out by power-hungry forces serving a "foreign agenda."
After the bombing in June, Saleh spent more than three months in Saudi Arabia for treatment, returning to Yemen unannounced and resuming his rule.
As Saleh funneled more resources to cracking down on protesters, security collapsed across the country. Armed tribesmen regularly battle security forces in areas north and south of the capital, and al-Qaida-linked militants took over entire towns in southern Yemen.
Saleh often used the fear of terrorism to shore up support for his rule, even striking deals with militants and using their fighters to suppress his enemies while raking in millions of dollars from the United States to combat the branch of al-Qaida that he let take root in his country.
The U.S. saw little choice but to partner with him, and Washington stepped up aid to Saleh to fight Al-Qaida in the Arabian Peninsula. That group, believed to be the terrorist group's most active branch, has been linked to plots inside the U.S.
The would-be bomber who tried to blow up a Detroit-bound plane on Christmas 2009 was in Yemen earlier that year. The Pakistani-American man who pleaded guilty to the May 2010 Times Square car bombing attempt was inspired by Internet postings by Anwar al-Awlaki, a Yemeni-American cleric who sought refuge in Yemen and was killed in a U.S. drone strike on Sept. 30. U.S. Maj. Nidal Malik Hasan, charged with killing 13 people in the Nov. 5, 2009, rampage at Fort Hood, also exchanged e-mails with al-Awlaki.
Even before the uprising began, Yemen was the poorest country in the Middle East, fractured and unstable with a government that had weak authority at best outside the capital.
For months, the U.S. and other world powers pressured Saleh to agree to the power transfer proposal by the Gulf Cooperation Council. He agreed, but then backed down before signing the deal.
The deal alone is unlikely to end the uprising or address Yemen's deeply rooted problems.
"He did sign, but I don't think this is the end of the crisis in Yemen," said Yemen expert Gregory Johnsen of Princeton University.
The deal doesn't address powerful members of Saleh's immediate family, including his son who heads the elite Republican Guard. His relatives could continue to act as proxies for Saleh inside the government.
Nor does the deal include Yemen's most powerful opposition figures and their armed followers, including an army general who defected to the opposition and the country's most powerful tribal leader.
A real democratic transition could create a government to challenge al-Qaida in restive southern Yemen, Johnsen said, "but at this point we are still along ways from that."
It is unclear when Saleh will return to Yemen.
U.N. Secretary-General Ban Ki-moon said Saleh told him in a phone call that he would travel to New York for medical treatment after signing the agreement. He didn't say when Saleh planned to arrive in New York, nor what treatment he would seek.
Saleh signed the deal just over a month after videos showed a bloody Moammar Gadhafi being heckled by armed rebels in Libya shortly before his death.
In some ways, the deal gave Saleh a way out. He can return to Yemen, so he won't be exiled like ousted Tunisian strongman Zine El Abidine Ben Ali. And it protects him from prosecution, so he won't be put on trial like Egypt's Hosni Mubarak.
Saleh implied he could play a role in Yemen's future. "I'll be among the most cooperative with the next coalition government," he said.
He said it would take decades to rebuild Yemen and struck out at those who strove to topple him, calling the protests a "coup" and the bombing of his palace mosque "a conspiracy" and "a scandal." As he spoke, dark scars on his hands from his burns were visible.
Protest leaders have rejected the Gulf proposal from the beginning, saying it ignores their principal demands of wide-ranging democratic reforms and putting Saleh on trial. They say the opposition political parties that signed the deal are compromised by their long association with Saleh's government.
Sanaa protest organizer Walid al-Ammari said the deal does not serve the interests of Yemen."
"We will continue to protest in the streets and public squares until we achieve all the goals that we set to achieve," he said.
Hubbard reported from Cairo.