A dispute between the speaker of the Somali Parliament and the country's president briefly threatened to turn violent Wednesday, the latest turn in a complex controversy over the proposed leasing of a major port to a company controlled by the United Arab Emirates.
Conflict was avoided, partly because of the efforts of an African Union soldier, but the dispute also highlighted the fragility of the federal government under the leadership of its new president, Mohamed Abdullahi Mohamed, known by the nickname Farmajo, who was elected last year in a process marred by corruption.
Mohamed leads a weak federal government that is trying to wield power and influence over six states, while al-Shabab, an offshoot of al-Qaida, regularly challenges its rule with acts of terrorism.
Last year, Somaliland, a stable and semiautonomous region in the country's north, signed a deal with DP World, a port management company based in the UAE, to operate the port of Berbera.
Somaliland considers itself an independent country and Somaliland officials negotiated the deal directly with DP World.
But lawmakers in Mogadishu, Somalia's capital, objected, saying that bypassing federal officials violated the sovereignty of Somalia.
In March, Parliament voted unanimously to cancel the deal, in a motion that the speaker, Mohamed Osman Jawari, presided over.
The bill, which included language that forbids any foreign investment contracts without approval by the Parliament, was put forward without input from the president or prime minister. Observers said the vote was a sign of the growing political strength of Jawari.
Allies of the president and the prime minister put forward a no-confidence motion against Jawari, which has twice been delayed for security reasons. On Wednesday, Jawari's backers accused opponents of having accepted money to vote against the speaker. "Down with bribe takers!" they chanted.
Parliamentary police officers loyal to Jawari lined up to protect the speaker's podium.
In response, state security forces loyal to the president deployed outside Parliament, raising fears that tensions between the two men could lead to violence.
Soldiers from Danab, a Somali special forces contingent trained by the United States, were also deployed to secure the Parliament.
The standoff ended after Paul Lokech, who leads a Ugandan contingent of the African Union peacekeeping force in Somalia, brokered a deal between Jawari and Mohamed to talk through the dispute.
"They need to dialogue and get their problems sorted out," Lokech said. "That's what we agreed upon."
The port deal is one illustration of the growing disruption that an international dispute has created in domestic Somali politics.
That rift 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 Mohamed's victory in last year's presidential election.
The vote against the DP World deal further strained relations between Somalia and the UAE, which wants to see Mohamed distance himself from his Qatari patrons and their allies.
"The Emiratis are waging a campaign against Farmajo," said Joshua Meservey, a senior policy analyst on Africa and the Middle East at the Heritage Foundation. "Farmajo has refused to join an embargo against Qatar and that has really angered the Saudis and the Emiratis. They just don't think Farmajo is playing ball as he should."
Jawari said at a news conference last month that the effort to oust him was intended to "dismantle the Parliament," which he said has been "under attack by the executive branch." His supporters, meanwhile, said that the government's dismissal of parliamentary police officers during the political dispute was meant to intimidate the opposition.
"The president and prime minister want a Parliament that works for them and that doesn't hold them accountable," said Abdirisak Omar Mohamed, an opposition lawmaker. "That's why they want Speaker Jawari gone. They know he is the only one we trust to lead an independent Parliament."