Yemen's President Abd-Rabbu Mansour Hadi has quit along with his prime minister and cabinet, plunging the country into political crisis even as Houthi rebels consolidated their grip on the capital.

Hours after Hadi resigned, authorities in four provinces of Yemen's formerly independent south, including its main city Aden, said they would defy all military orders from Sanaa. 

The committee in charge of military and security affairs for Aden, Abyan, Lahej and Daleh, which is loyal to Hadi, condemned the "tragic events in Sanaa and the totally unacceptable demands made by the Houthis," the Shia fighters who have controlled much of the capital since September.

Hadi's resignation on Thursday came a day after he and Houthi rebels announced that they had reached an agreement to resolve the crisis gripping the country.

Government spokesman Rageh Badi said the cabinet headed by Prime Minister Khaled Bahah handed its resignation to Hadi on Thursday without providing further details, the AP news agency reported. Hadi then resigned shortly afterwards. 

Al Jazeera's correspondent in Yemen said Hadi had "accepted all the demands" put forward by the Shia fighters but that the rebels did not meet the conditions in Wednesday's agreement of withdrawing troops from the president's home and releasing Hadi's chief of staff Ahmed Awad bin Mubarak, who was taken on Saturday. 

Bahah's government was formed in November as part of a UN-brokered peace deal after the Houthis overran the capital in September.

'Biggest crisis'

The prime minister posted his resignation on his official Facebook page, saying he had held office in "very complicated circumstances".

He said he resigned in order to "avoid being dragged into an abyss of unconstructive policies based on no law."

"We don't want to be a party to what is happening or will happen," he added. 

Al Jazeera's Hashem Ahelberra, who has reported extensively on Yemen, said the resignation is the "biggest crisis in Yemen's political history" and would likely create a power vacuum.

Jen Psaki, the spokeswoman for the US State Department, said Washington would "continue to encourage and support a peaceful transition" in the country where it is battling al-Qaeda. 

We found out that we are unable to achieve the goal, for which we bear a lot of pain and disappointment.

President Abdrabuh Mansur Hadi, Resignation letter

The rebels had agreed to withdraw from areas overlooking the presidential palace and the private compound of Hadi, after receiving assurances of constitutional change and power-sharing.

Although the Houthis had welcomed the proposed concessions by the government on power-sharing, their fighters on Thursday still held positions outside the residence of Hadi.

Abu al-Malek Yousef al-Fishi, seen as the ideologue of the Houthis' Ansarullah group, described the resignation as good news for all Yemenis and said on Twitter that the Arab country was heading towards "security, stability, tranquillity and prosperity".

"I propose setting up a presidential council of the honourable revolutionary and political components, and in which the army, security and the popular committees will be represented, so everybody will participate in managing what remains of the transitional period," he added in another tweet.

But Abdelmalek al-Ejri, a member of the Ansarullah politburo, suggested that comments on social media by some Houthi leaders did not represent the Shia movement's official position on the departures of Hadi and Prime Minister Khaled Bahah.

"Until this moment, no official position has been issued regarding the resignation of Hadi and Bahah," he said on Twitter.

Source: Al Jazeera and agencies