Yemen: Deal to end political crisis signed Published duration 21 September 2014

image copyright AFP image caption Armed Houthi rebels reportedly took over key buildings in Sanaa on Sunday

The Yemeni government and Shia Houthi rebels have signed an agreement aimed at ending the political crisis which has gripped the country for weeks.

Under the deal, a new government will be formed and the Houthis and southern separatists will nominate a new prime minister within three days.

It comes hours after the prime minister quit amid clashes between rebels and pro-government forces in the capital.

Scores of people have died and hundreds fled as clashes escalated in Sanaa.

On Sunday, the rebels said they had taken over government headquarters, key ministries and state broadcasters.

As the fighting intensified, Mohammed Basindwa said he would resign in order to clear the way for the agreement between the rebels and President Abdrabbuh Mansour Hadi.

The BBC's Mai Noman in Sanaa says the formation of a new national unity government under a new prime minister was one of the Houthi movement's demands.

media caption Mai Noman reports from the Yemeni capital

Analysis: Sebastian Usher, BBC Arab Affairs Editor

The UN-brokered deal may have defused the most urgent and immediate of Yemen's many crises. The demands of the Houthis have been met and there will be a new government.

Their show of force has worked, putting the group that was not so long ago seen as having little resonance beyond their stronghold in the north at the heart of political power in Yemen. That is clearly a victory.

But no-one is quite sure how far their ambitions stretch.

Will they now leave Sanaa and give up some of the territory they've won in recent months? That is a big question that has not yet been answered.

The president himself may have finessed his way through another extremely difficult challenge to his authority, but he is likely to be seen as weakened by concessions to the Houthis extracted by force.

The losers for now seem to be the Sunni Islamist movement Islah, which has long confronted the Houthis. The powerful military commander, Gen Ali Mohsen al-Ahmar, also seems to have suffered a major setback.

But it appears unlikely that these two long-term forces in Yemen will accept the new order quietly.

A statement on the Yemeni interior ministry's website urged the security forces to avoid confrontation with the rebels, describing them as "friends of the police".

Houthi spokesman Mohamed Abdulsalam also suggested that the rebels were aligned with elements within the security forces.

"The military and security apparatus have supported the popular revolt," Mr Abdulsalam said on his Facebook page.

The latest clashes were centred on a military base in Sanaa and the Iman university complex, both seen as strongholds of Sunni Islamist fighters and supporters of the Islah opposition party.

image copyright Reuters image caption A military base in northern Sanaa came under attack on Sunday even as reports of a truce deal emerged

image copyright Reuters image caption Hussein al-Ezzi, head of political relations for the Houthis, signed the agreement at a ceremony in Sanaa

President Hadi had earlier described the rebel offensive as a "coup attempt".

But later on Sunday, he attended a ceremony in Sanaa where Houthi rebels signed the deal, which had been brokered by UN envoy Jamal Benomar.

The deal called on the Houthis to hand over all military and government buildings they had seized in the capital but it is unclear whether the rebels are respecting this aspect of the accord.

Yemen has remained unstable since anti-government protests in 2011 forced the then-President Ali Abdallah Saleh from office. Mr Basindwa became PM in the government that succeeded Mr Saleh.

Based in Yemen's mountainous north, the Houthis have been advancing on the capital for weeks, clashing with rivals and organising mass protests calling for greater rights.

The Houthi rebels, who belong to the minority Zaidi Shia community, have staged periodic uprisings since 2004 to win greater autonomy for their northern heartland of Saada province.

They consolidated control over Saada during the 2011 uprising and since July have inflicted defeats on tribal and militia groups backed by Islah, in neighbouring Amran province.

More recently they have demanded the president reverse a decision to cut fuel subsidies, which President Hadi agreed to do as part of Sunday's deal.

Timeline: Recent key events

29 July - Govt removes fuel subsidies as part of economic reforms; fuel prices nearly double

18 Aug - Houthis set up armed protest camps in Sanaa

31 Aug - Houthi leader calls for campaign of civil disobedience

2 Sept - President agrees to dismiss govt; promises to review subsidy cuts - Houthis reject move

10 Sept - Security forces shoot dead seven Houthis protesters outside cabinet building

18 Sept - Clashes between Houthis and Sunni militias in Sanaa leave 40 dead

21 Sept - Houthis occupy key buildings in Sanaa; PM resigns; deal for new unity govt signed