Yemeni Prime Minister Mohammed Salem Basindwa speaking during a ceremony at the cabinet headquarters in Sanaa earlier this year.

AFP/Sanaa

Shia rebels seized the Yemeni government headquarters on Sunday and the premier resigned as violence raged despite a UN announcement of a power-sharing deal to end days of fighting, officials said.

Prime Minister Mohamed Basindawa stepped aside, accusing President Abdrabuh Mansur Hadi of being "autocratic", senior officials said.

State news agency Saba reported Basindawa's resignation, but did not give any reason.

Mohammed Abdulsalam, spokesman for the Ansarullah rebels, also known as Huthis, confirmed on his Facebook page that the seat of government had been taken.

Earlier, shelling and gunfire in the north of Sanaa was heard across the city, as Sunni militiamen and troops battled the rebels, prompting an exodus of terrified residents, witnesses reported.

A week of fighting has left dozens of people dead on both sides and forced the suspension of all flights into and out of Sanaa airport, which is in the battle zone.

There was no let-up in the fighting on Saturday night despite Hadi ordering an after-dark curfew.

The clashes centred on the campus of Al-Iman University, a bastion of Sunni Islamists that the Shia rebels have been trying to capture, witnesses said.

The violence came despite UN envoy Jamal Benomar announcing late on Saturday that a deal had been reached after "intense consultations with all the political parties, including Ansarullah".

Benomar did not specifically mention a ceasefire, nor did he say when a deal would be signed, although he said preparations were under way for the signing.

But he did say the accord will be a "national document that will advance the path of peaceful change, and will lay the foundations for national partnership and for security and stability in the country".

Forces allied to the government have been battling to halt the rebels, who swept into Sanaa from their mountain stronghold in the far north last month and set up armed protest camps across the capital to press their demands.

Hadi has denounced the rebel offensive as a "coup attempt", but agreed to involve the rebels in the formation of a new government to replace the unpopular administration that imposed austerity measures, including a fuel price hike, earlier this year.

He has also agreed to partly reverse the price hike.

But the rebels have also demanded posts in key state institutions as part of a push for greater political clout.

The fighting in northern Sanaa has raged continuously since Thursday when nearly 40 people were killed in a single day.

Residents of northern districts have begun to flee their homes, witnesses reported.

The city's streets were largely deserted as shops remained closed and the education ministry ordered schools to suspend lessons indefinitely.

Sanaa University told students to stay away until mid-October after its campus was hit by shellfire.

One of Sanaa's main markets, the Ali Mohsen Souk, has been closed for three days, which residents said had started to cause problems in obtaining fresh produce.

Yemen has been swept by political turmoil since longtime strongman Ali Abdullah Saleh was forced from the presidency in early 2012.

Related Story