RIYADH, Saudi Arabia -- Yemen's authoritarian President Ali Abdullah Saleh agreed Wednesday to step down amid a fierce uprising to oust him after 33 years in power. The U.S. and its powerful Gulf allies pressed for the deal, concerned that a security collapse in the impoverished Arab nation was allowing an active al-Qaida franchise to gain a firmer foothold.
Saleh is the fourth Arab leader toppled in the wave of Arab Spring uprisings this year, after longtime dictators fell in Tunisia, Egypt and Libya. The deal gives Saleh immunity from prosecution - contradicting a key demand of Yemen's opposition protesters.
Seated beside Saudi King Abdullah in the Saudi capital Riyadh, Saleh signed the U.S.-backed deal hammered out by his country's powerful Gulf Arab neighbors to transfer power within 30 days to his vice president, Abed Rabbo Mansour Hadi. That will be followed by early presidential elections within 90 days.
He was dressed smartly in a dark business suit with a matching striped tie and handkerchief, and he smiled as he signed the deal, then clapped his hands a few times. He then spoke for a few minutes to members of the Saudi royal families and international diplomats, promising his ruling party "will be cooperative" in working with a new unity government.
"This disagreement for the last 10 months has had a big impact on Yemen in the realms of culture, development, politics, which led to a threat to national unity and destroyed what has been built in past years," he said.
Protesters camped out in a public square near Sanaa's university immediately rejected the deal, chanting, "No immunity for the killer." They vowed to continued their protests.
Saleh has clung to power despite the daily mass protests calling for his ouster and a June assassination attempt that left him badly wounded and forced him to travel to Saudi Arabia for more than three months of hospital treatment.
Since February, tens of thousands of Yemenis have protested in cities and towns across the nation, calling for democracy and the fall of Saleh's regime. The uprising has led to a security collapse, with armed tribesmen battling security forces in different regions and al-Qaida-linked militants stepping up operations in the country's restive south.
For months, the U.S. and other world powers pressured Saleh to agree to the power transfer proposal by the Gulf Cooperation Council, and he agreed then backed down several times before. All the while, the uprising raged, security and the economy deteriorated. Al-Qaida in the Arabian Peninsula grew more bold, even seizing some territory.
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 Sanaa.
Security is particularly bad in southern Yemen, where al-Qaida militants - from one of the world's most active branches of the terror network - have taken control of entire towns, using the turmoil to strengthen their position.
The nation of some 25 million people is of strategic value to the United States and its Gulf Arab allies, particularly Saudi Arabia. It sits close to the major Gulf oil fields and overlooks key shipping lanes in the Red and Arabian seas.
Saleh addressed the country's troubles without mentioning the demands of protesters who have filled squares across Yemen calling for his ouster, often facing deadly crackdowns from his security forces.
He also struck out at those who strove to topple him, calling the protests the protests a "coup" and the bombing of his palace mosque that seriously wounded him in June "a scandal."
Saleh said his ruling party will be "among the principal participants" in the proposed national unity government that is to be formed between his party and opposition parties, who also signed the deal.
Protests leaders have rejected the Gulf proposal from the beginning, saying it ignores their principle demands, which include instituting 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.
The plan Saleh agreed to calls for a two-year transition period in which a national unity government will amend the constitution, work to restore security and hold a national dialogue on the country's future.
The unarmed protesters have held their ground with remarkable resilience, flocking to the streets of Sanaa and other Yemeni cities and towns to demand reforms and braving a violent crackdown by government forces that has killed hundreds.
Their uprising has at times been hijacked by Yemen's two traditional powers - the tribes and the military - further deepening the country's turmoil. Breakaway military units and tribal fighters have been battling in Sanaa with troops loyal to Saleh in fighting that has escalated in recent months.
U.N. Secretary General Ban Ki-Moon told reporters earlier today that Saleh said he may be heading to New York for medical treatment, Reuters reports.
"He told me that he will come to New York to take medical treatment immediately after signing this agreement," Ban said.
Hubbard reported from Cairo.