SANAA, Yemen - President Abdrabuh Mansur Hadi and Yemen's powerful Shiite militia agreed Wednesday to end a deadly confrontation that had raised fears the impoverished but strategic country might descend into chaos.
The militia, known as Huthis, seized almost full control of Sanaa in September and have fought pitched battles with government forces in the capital this week as they continued to press for more political power.
The unrest has raised deep international concern, with the UN Security Council condemning the attacks and backing Hadi as Yemen's "legitimate authority".
Under a nine-point deal, the militia agreed to withdraw from government buildings they seized this week in violence that killed at least 35 people and wounded 94, in return for concessions over a disputed draft constitution, state news agency Saba said.
There were no signs of violence Wednesday.
The Huthis pledged to vacate the presidential palace, a day after seizing it, and to free Hadi's chief of staff, who was abducted Saturday.
Militiamen would also "withdraw from all positions overlooking the house of the president" and leave the residence of Prime Minister Khalid Bahah, which they encircled Monday.
In return, it would now be "possible to amend" the draft constitution dividing Yemen into six federal regions, which the Huthis opposed, said Saba.
"The draft constitution should be agreed upon by all factions," according to the deal, and Yemen "will be a federal state in accordance with the outcome of the national dialogue."
The agreement also pledges to treat Huthis, known officially as Ansarullah, and other disgruntled factions equally in the allocation of public posts.
"Ansarullah and peaceful Southern Movement and all other political factions deprived of equal representation in state institutions will have the right to be appointed in these institutions," it said.
Move to 'normalise' capital
The president and Huthis also agreed to "normalise" the situation in the capital which has been gripped by uncertainty and tension in recent days, calling for people to return to work and schools to reopen.
Speaking in Washington, US Secretary of State John Kerry said it was his understanding Hadi's government is "going to accept if not all, most of, the objections that the Huthis had."
This week's escalation raised fears of a collapse of Hadi's government, a key ally in America's fight against Al-Qaeda, and of the country descending into chaos.
Kerry noted the militia had declared Hadi was still president, and US officials were waiting to hold another meeting with the beleaguered Yemeni leader.
That would "make a determination from his point of view exactly where things stand," Kerry said, after being asked about the confusing, fluid events in the Yemeni capital.
"Things are quiet in Yemen as of a little while ago. Our personnel are well-protected, we have strong and multiple personnel there," he said.
He said he would head to the White House later for talks on the crisis which has rocked the US ally, a key component of Washington's fight against Al-Qaeda.
Yemen's branch of the jihadist network, Al-Qaeda in the Arabian Peninsula, is considered its most dangerous and claimed responsibility for this month's deadly attack on French weekly Charlie Hebdo.
The rising unrest has fuelled longtime divisions in Yemen, where the government, Huthis, southern separatists, powerful Sunni tribes and AQAP are all vying for influence.
The Huthis raised the stakes Saturday by kidnapping Hadi chief of staff Ahmed Awad bin Mubarak in an apparent bid to extract changes to the draft constitution.
Mubarak is leading efforts to reform how Yemen is governed under a "national dialogue" set up after longtime president Ali Abdullah Saleh was forced from power in 2012 following a year of bloody protests.
Ibrahim Sharquieh, conflict resolution expert at the Brookings Institute in Doha, said the Huthis wanted "to rule but not govern" Yemen.
"They want to leave Hadi as president but they want him and the government to be fully cooperative with them," he added.
Saleh's party released a letter Wednesday it said the former leader sent to Hadi last month urging him to "hold early presidential and parliamentary elections to resolve the country's crisis".
Saleh has been accused of backing the Huthis, who are from the same Zaidi sect of Shiite Islam as the ex-leader, as has Shiite-dominated Iran.
Meanwhile, Yemen's second city Aden shut its airport, seaport and entrances to the city due to "dangerous developments in the capital" and "attacks on the symbol of national sovereignty and constitutional legitimacy".
Since they seized Sanaa, the Huthis have pressed their advance south of the capital, where they have met stiff resistance from Sunnis, including Al-Qaeda loyalists.