MOGADISHU, Somalia — The speaker of Somalia’s Parliament resigned on Monday ahead of a no-confidence vote, sparing the country a repeat of the armed standoff last week that threatened to descend into violence.
The decision by the speaker, Mohamed Osman Jawari, could mean a peaceful resolution to the power struggle between him and the president, Mohamed Abdullahi Mohamed.
Last week, a no-confidence motion by Mr. Mohamed’s allies against Mr. Jawari led to a face-off between armed members of the security services — those loyal to the speaker inside the Parliament, and those loyal to the president outside. The deadlock lasted several hours and ended after mediation by the African Union.
Abdurahman Hosh Jibril, the minister of constitutional affairs and a professed critic of Mr. Jawari, praised the speaker for “taking the higher road.”
“He saved the country from going into conflict,” Mr. Jibril said. “I am impressed that he compromised for the sake of the nation.”
The president and the speaker had been on a collision course since a vote in Parliament last month to require legislative approval for future foreign investment deals, a move interpreted as an encroachment on executive power.
Mr. Mohamed leads a weak federal government that is struggling to assert power and influence over five states. The Shabaab, an offshoot of Al Qaeda, regularly challenges the central government’s rule with acts of terrorism.
Mr. Jawari held early-morning meetings with supporters on Monday and said he would agree, reluctantly, to resign, if Mr. Mohamed and his supporters agreed to form a broad coalition government, according to lawmakers present at the meetings or briefed afterward. Political figures close to the president deny that any such agreement was reached.
The battle between the presidency and Parliament taps into a longstanding fight between Somalia’s government institutions, a struggle that is likely to be reshaped by any coming negotiations over power-sharing.
“There has been gridlock within central government institutions going back four or five years, and constant feuding at the center over a whole range of issues, including this balance of power,” said Michael Woldemariam, an assistant professor of international relations at Boston University. “Then there’s the broader issue of the legislature, and how much autonomy and influence it should have.”
The fight for power also pits the country’s six states against the central government, a relationship that is defined primarily by a young — and provisional — Constitution.
“A lot of power, roles and responsibilities have not been clearly laid out” in that document, said Omar Mahmood, an analyst on the Horn of Africa for the Institute for Security Studies, who is based in Ethiopia.
There is a continuing process to create a permanent constitution, he said, “but ahead of that, people are jockeying for power and trying to influence it.”
Among those competing for influence are countries in the Persian Gulf region, whose politics are increasingly playing a role in Somalia.
A rift in the Gulf has pitted Saudi Arabia and the United Arab Emirates, which are major trading partners with Somalia, against Qatar, whose financial support was widely seen as a critical factor in Mr. Mohamed’s victory in last year’s presidential election.
Ahead of Mr. Jawari’s resignation, the government impounded a suitcase it said contained $9.6 million in cash, from a plane that had arrived from the United Arab Emirates. The Emirati ambassador said the money was intended to pay its soldiers, who are training Somali national forces, but the government said it was still investigating the matter.
In March, Parliament voted unanimously to cancel an investment deal between the Republic of Somaliland and DP World, a shipping company based in the United Arab Emirates. That vote, taken without consulting Mr. Mohamed, prompted the conflict between the president and the speaker and soured relations with the Emirates.
Officials in the Emirates and in Somaliland have said they will ignore the vote and proceed with the deal, exacerbating the power struggle.
Experts said that the Shabaab, which has strongholds just outside the capital, benefited from — and contributed to — that power struggle.
“It’s absolutely the case that Al Shabaab exploits a weak central government,” Mr. Woldemariam said, “but I also think the Shabaab problem, and Shabaab’s strength in the countryside, is driving some of the fragmentation we see within the Somali state.”
In October, more than 500 people died when a car bomb exploded at a busy intersection on the outskirts of the capital, Mogadishu. Shabaab has not publicly accepted responsibility for the attack, though experts say it had the marks of an action by the group.
“It was the worst thing that happened in Somalia’s history,” Mr. Mahmood, the analyst, said, “and the politicians were just bickering internally about other issues.”
Christina Goldbaum reported from Mogadishu, and Jina Moore from Nairobi, Kenya. Hussein Mohamed contributed reporting from Mogadishu, and Mohamed Ibrahim from Helsinki, Finland.