An armed mob loyal to the Yemeni president have trapped US, British, European and Arab ambassadors inside a diplomatic mission in the capital, throwing into doubt a deal for Ali Abdullah Saleh to step down after 32 years in power.

Men wielding knives, daggers and swords were seen roaming the streets outside the United Arab Emirates embassy in Sanaa, where the ambassadors were meeting before the planned signing of the agreement. "Everybody is worried. We can't leave the embassy," said a Saudi diplomat.

Saleh has backed away from signing the US-backed deal at least twice before, adding to the opposition's deep mistrust of a leader known for adept political manoeuvring.

Yemen's opposition coalition signed the deal on Saturday, based on what it said were guarantees the president would sign the next day. But the ruling party said in a statement early on Sunday that Saleh objected to signing "behind closed doors" and wanted a public event attended by the opposition.

The deal, mediated by the six-nation Gulf Co-operation Council, calls for Saleh to step down in 30 days and transfer power to his vice-president. It also would give him immunity from prosecution.

Even if Saleh went ahead with the planned signing, it was far from certain whether it would satisfy the many different groups protesting over his rule. Hundreds of thousands poured into a central square that has become the centre of opposition protests, waving Yemeni flags and shouting rejection of the deal. They held banners that read: "Now, now Ali, down with the president!" and "Go out Ali!"

The protesters say the deal falls short of their demands for Saleh's immediate departure and the dismantling of his regime. They also reject any immunity for the Yemeni leader and say the opposition parties do not speak for their demands.

"This initiative is only meant to save Ali, not Yemen. We are going to continue our revolution until the end. Like Tunisia and Egypt, we will go against the opposition if they form a government while Saleh is still in power," said Tawakul Karman, a protest leader and senior member of the opposition Islamic fundamentalist Islah party.

In what appeared to be a state-orchestrated move to show a security void, pro-Saleh militiamen dressed in traditional Yemeni dress, with daggers at their waists, roamed the streets of the capital.

At one point, armed men attacked a convoy of the Gulf Co-operation Council's chief mediator, Abdullatif bin Rashid al-Zayani, to try to keep it from reaching the UAE embassy, witnesses said. Pounding the car, they shouted against Gulf intervention in Yemeni affairs.

The convoy of the Chinese ambassador also came under attack by armed men before police were deployed to clear the way.

Dozens of pro-Saleh loyalists gathered in front of the police academy, where the ruling party general assembly had convened to discuss the deal. "We are coming under pressure to reject the initiative," said Mohammed Saad, a general assembly member.

Dozens of other supporters erected a tent in one of Sanaa's main streets, blocking traffic and raising banners that read: "Don't go, don't sign!"

Saleh has swung between offering concessions, taking them back and executing a violent crackdown that has killed more than 150 people, according to the opposition.

The bloodshed triggered a wave of defections by ruling party members, cabinet ministers and senior diplomats. Several army commanders joined the opposition and deployed their tanks in the streets of Sanaa to protect the protesters.

Saleh has been able to survive thanks to the loyalty of Yemen's most highly trained and best-equipped military units, which are led by close family members. That has raised concerns the political crisis could turn into an armed clash between the rival military forces if a deal is further delayed.

Seeking to win some support in the west for his continued rule, Saleh has warned several times that without him al-Qaida would take control of the country.