SANAA (Reuters) - Yemen's Shiite Muslim rebels on Sunday signed an agreement with other political parties to form a more inclusive government and end days of fighting on the streets of the capital.

Prime Minister Mohammed Basindwa had earlier submitted his resignation to President Abd-Rabbu Mansour Hadi to pave the way for the deal, as rebel Houthi forces advanced on government buildings in the capital Sanaa to little resistance from the troops and security forces guarding them.

Sanaa residents said the Houthis had taken over several government sites including the prime minister's complex, an army command center and the state television compound after security forces withdrew -- although TV broadcasts continued.

More than 100 people have been killed in four days of clashes between the northern Houthis, who have been fighting the Sanaa government on and off for a decade, and troops loyal to an army general whom they have long accused of following a militant Islamist school of thought that brands Shiites as heretics.

Hadi presided over the signing ceremony at the presidential palace in which representatives of the main political parties, including a wing of the southern separatist Herak group, the Houthis and the Islamist Islah party signed the accord.

U.N. special envoy Jamal Benomar, who held talks with Houthi leader Abdulmalek al-Houthi in his home province of Saada Wednesday and Thursday, announced on Saturday an agreement had been reached.

The Yemeni government press office said the agreement called for an immediate ceasefire and an end to all violence.

"It also calls for the formation of a technocrat national government that will work to enhance government transparency and implement economic reforms, in addition to continuing military and security reforms," its statement added.The fighting in Sanaa has threatened a U.N.-backed transition to democracy that began when protests broke out in 2011 against veteran president Ali Abdullah Saleh, who was forced to step down after 30 years in power.

Basindwa took office in 2011 as head of a national unity government under a gulf-brokered transition deal.