SANAA (Reuters) - Yemen's Shi'ite Muslim rebels signed an agreement with other political parties on Sunday to form a more inclusive government after rebels advanced on major state institutions in the capital Sanaa, largely unopposed by troops and security forces.
The accord aims to address a decade-old Shi'ite Houthi insurgency and a spate of bloodshed this month that posed a major threat to U.N.-backed efforts to stabilise the country, which neighbours oil giant Saudi Arabia and has also struggled to contain al Qaeda militants and southern secessionists.
Hours before the signing ceremony Prime Minister Mohammed Basindwa submitted his resignation to President Abd-Rabbu Mansour Hadi, saying he hoped the move would help consensus emerge from the accord.
His resignation added to the uncertainty in Sanaa, where more than 100 people have been killed in four days of clashes between the Houthis and troops loyal to an army general they have long accused of following a militant Islamist views that brand Shi'ites as heretics.
Sanaa residents said Houthis had taken over several government sites including the prime minister's buildings, an army command centre and the state television compound after security forces withdrew - although TV broadcasts continued.
After the accord was signed, state news agency Saba said that military police have begun taking back government buildings seized by the Houthis, though it was unclear how much control the rebels were prepared to cede.
Witnesses at the ceremony said the Houthi representatives, who flew to Sanaa on a special flight from Saada, some 540 km (330 miles) to the north, refused to sign an annex to the accord which calls for the state to take control of areas seized by the Houthis and to return weapons captured during the fighting.
Other factions who signed the accord, overseen by Hadi at the presidential palace, included a wing of the southern separatist Herak group and the Islamist Islah party.
The accord calls for the creation of a new national unity government within one month which will bring in the Houthis and mostly reverse an unpopular decision to increase fuel prices.
Despite the refusal of the Houthis -- and the small Nasserite party -- to sign the annex, Hadi immediately declared a ceasefire. "I call on all parties to work together to implement the terms of this agreement from this moment," he said in a televised speech.
The Yemeni government press office said that as well as demanding an immediate ceasefire and an end to all violence, the accord "calls for the formation of a technocrat national government which will work to enhance government transparency, implement economic reforms, in addition to continuing military and security reforms."
There was no immediate comment from Hadi's office about Basindwa's resignation but U.N. special envoy Jamal Benomar, who mediated the agreement, said Basindwa's administration will remain as a caretaker government until a new cabinet is formed.
Basindwa took office as head of a national unity government in 2011 under a Gulf-brokered deal that eventually led to veteran president Ali Abdullah Saleh stepping aside in the wake of prolonged protest against his three decades in office.
The Houthis, who stayed out of Basindwa's government, have pressed for a new administration. Last month, they began a wave of demonstrations in Sanaa to protest against the raise in fuel prices, a move that had been taken to curb the rising budget deficit. The protests later escalated into armed clashes.
The group, whose ultimate goal is to restore the Zaydi imamate that was toppled in a 1962 coup, has fought several battles with the central government under Saleh's rule before a ceasefire took hold in 2010.
The fighting in Sanaa threatens the U.N.-backed transition to democracy that began after Saleh stepped down in 2012. The clashes had largely been concentrated in the north of the city near the headquarters of the First Armoured Division, a force loyal to General Ali Mohsen.
Houthi rebels on Sunday captured the Division's headquarters and an adjacent religious university run by a Sunni Muslim seen as another enemy of the group that hails from the Zaydi branch of Shi'ite Islam.
Students and security guards at the university run by Abdel-Majeed al-Zindani, a prominent cleric who is on a U.S. terrorism blacklist, were later forced to quit the campus due to the Houthi attacks, a university official told Reuters on Sunday.
The rebels had earlier beaten back a military force stationed to protect the state television station.
The Interior Ministry's website said the minister had instructed security forces to avoid clashing with the Houthis, but one resident said on Sunday he had counted at least 10 bodies -- six Houthi fighters and four uniformed soldiers -- killed in the fighting.
Fighting raged throughout Saturday on the outskirts of Sanaa and the rebels said they had taken control of the headquarters of state television, though broadcasting continued from a different location.
Yemen's Higher Security Committee announced a curfew in four areas of the capital from 9 p.m. until 6 a.m. and schools have been shut until further notice.
Reporting By Mohammed Ghobari; Writing Sami Aboudi and Maha El Dahan,; Editing by William Maclean and Dominic Evans