Yemen's president was to sign an agreement today to quit power in a month's time in exchange for immunity, a deal rejected by street protesters demanding he step down immediately and face prosecution.
Ali Abdullah Saleh, who has ruled the Arabian Peninsula state for nearly 33 years, has in principle accepted the agreement negotiated by the six-state Gulf Cooperation Council (GCC).
His departure would make Saleh the third ruler to be ousted by a wave of popular uprisings against autocratic Arab leaders that brought down the presidents of Tunisia and Egypt.
Saleh, a shrewd political operator considered a US ally against al-Qa'ida's Yemen-based wing, has forced mediators to split the signing ceremonies over two days and has objected to the presence of Qatari officials.
Qatar's prime minister was first to state publicly the Gulf deal would seek Saleh's resignation, and its satellite TV channel Al Jazeera has been blamed by Saleh for inciting revolt in the Arab world, swept by pro-democracy protests.
While the Yemeni leader signs the pact in Sanaa, his party's vice president will travel to the Saudi capital Riyadh for Sunday's official signing ceremony by the opposition.
The Secretary-General of the GCC, Abdullatif al-Zayani, arrived in Sanaa to deliver the initiative to Saleh for him to ratify later in the day, a government official said.
Zayani also carried invitations to all sides to attend Sunday's signing ceremony in Riyadh, the official added.
Gunmen killed 12 protesters in Sanaa on Wednesday and the opposition warned violence could derail the deal to end a three-month-old standoff.
Violence broke out in south Yemen ahead of the signing when gunmen shot dead two police officers and wounded two more in the port city of Aden, state media said. Witnesses said the gunmen had tried to attack a police station and a gunbattle followed.
They said gunfire also erupted outside a nearby prison and three protesters were wounded when security forces tried to break up a protest in the same area of Aden. Armoured vehicles were patrolling the streets, the witnesses said.
Analysts say the government fears southern separatists may be trying to take advantage of Yemen's leadership crisis to renew a push for secession.
Protesters say they will stay on the streets until Saleh leaves. They also called for him to be put on trial for corruption and the deaths of the estimated 142 protesters killed since protest rallies began three months ago.
The GCC deal offers Saleh and his entourage, including relatives who run branches of the security forces, immunity from prosecution.
"The people want the trial of the murderer," some anti-Saleh demonstrators shouted at a protest on Friday that ended in a funeral march for 12 protesters killed on Wednesday, thousands passing their wooden coffins from hand to hand to their graves.
Analysts say the 30-day window for Saleh to resign gives plenty of time for disgruntled forces from the old guard to stir trouble in Yemen, where half the population owns a gun and al Qaeda has gained a foothold in its mountainous regions.
The United States and neighbouring oil giant Saudi Arabia want the Yemen standoff resolved to avert chaos that could enable al Qaeda's Yemen wing to operate more freely.
Should the deal go through, Saleh would appoint a prime minister from the opposition to head a transitional government, which would set a presidential election for 60 days after he resigns.
Many protesters, distrustful of the opposition coalition due to its presence in the government in past years, called for them to back out of the deal.
"They wouldn't lose anything because Saleh isn't going to stick to the agreement. If he can't find a reason to overturn it he'll spark a war," Sanaa protester Abdulsalam Mahmoud said.