Yemeni President Ali Abdullah Saleh has signed a deal to hand over his powers under an agreement brokered by the Gulf Co-operation Council.
The deal signed on Wednesday, will see Saleh leave office in 30 days, making way for Abdrabuh Mansur Hadi, the Yemeni vice-president, to negotiate a power transfer with the opposition in return for a promise of immunity from prosecution.
As part of the deal Saleh will retain the honorary title of president, yet his deputy is expected to form and preside over a national unity government before presidential elections take place within 90 days.
In response to the deal, there were mixed reactions some protesters celebrated, while other rallied in Change Square in the capital, Sanaa, and said they would reject a deal giving the president immunity.
Live footage of the ceremony aired by Saudi state television showed Saleh sign the Gulf- and UN-brokered agreement in Riyadh's Al-Yamama royal palace watched over by members of the Yemeni opposition as well as Saudi King Abdullah and Gulf foreign ministers.
Saleh, who has ruled Yemen since 1978, spoke of the cost of the uprising to Yemen, but did not mention the demands of protesters who called for his ouster. Instead, he referred to the protests as a "coup'' and called a bombing of his palace mosque that seriously wounded him "a scandal."
After signing the deal, Saleh said his government welcomes the partnership with what he called the "brothers in the opposition" and pledged a "real partnership" with them.
The Saudi king hailed the signing as marking a "new page" in the Yemen's history.
Saleh, 69, will now seek medical treatment in New York, UN chief Ban Ki-moon said on Wednesday.
"He [Saleh] told me that he would come to New York after signing the agreement to have medical treatment," Ban said, giving details of a telephone conversation they had on Tuesday.
Saleh had rejected signing similar agreement to step down in the past few months, sometimes resisting at the last minute.
In response to the deal, Yemenis voiced both joy and frustration. Celebrations erupted in Sanaa as Yemenis danced through the street, but many others said the deal is not enough for them
Al Jazeera's special correspondent in Sanaa said that those gathered are "protesting his [Saleh's] immunity from any legal repercussions".
"There is a tension in the air. Most people are here to celebrate, but they see it only as a victory for now," our special correspondent said.
Saleh's family members continue to have powerful posts in the military and intelligence service, and it is unclear how much political power Saleh will have.
"For youth revolutionaries this deal is not accepted," Ibrahim Mohamed al-Sayidi, a Yemeni youth opposition activist, told Al Jazeera.
Live Box 201131716250932154
The US welcomed the deal and Mark Toner, a state department spokesperson, said: "The United States applauds the Yemeni government and the opposition for agreeing to a peaceful and orderly transition of power."
In May, Saleh's supporters - many of which also reject the GCC deal - took to the streets besieging the UAE embassy in Sanaa where foreign ambassadors were gathered for a signing ceremony. The UAE is one of the members of the GCC.
The signing was postponed and clashes broke out for the first time between Ahmar's men and Saleh's forces in Al-Hasaba.
Source: Al Jazeera and agencies