The United Arab Emirates (UAE) is ending a military training program in Somalia in response to the seizure of millions of dollars and the temporary holding of a UAE plane by Somali security forces last week.
The UAE has trained hundreds of troops since 2014 as part of an effort boosted by an African Union military mission to defeat the al-Shabaab terrorist group and secure the country for the government backed by Western nations, Turkey and the United Nations.
Analysts say Somalia's relations with UAE are strained by a dispute between Qatar and Saudi because Mogadishu has refused to take sides. Arab states have strong trading links with and influence in Somalia, but that is offset by the sway of Qatar and its ally Turkey, one of Somalia's biggest foreign investors.
Rashid Abdi, an analyst with the International Crisis Group, told AFP that while the UAE and Somalia have traditionally been close, and Mogadishu has vowed to remain neutral over the Gulf divisions, the central government is nevertheless "perceived to be very much pro-Qatar".
Some of Somalia's federal states were unhappy with President Mohamed Abdullahi Mohamed's neutral stance, and have broken with the official position to side with the UAE.
An Emirati government statement on Sunday followed a similar announcement by Somalia on April 11, in which Mogadishu said it will take over paying and training the soldiers in the program.
"The UAE has decided to disband its military training program in Somalia which started in 2014 to build the capabilities of the Somali army," said the statement on the UAE's state news agency WAM.
About $9.6 million in cash was taken from the UAE plane on April 8, Somali police and government sources had said.
"The security forces noticed the suspicious bags and handed them over to the concerned departments," Somalia's security ministry said in a statement.
The UAE said the money was to pay for salaries for Somali soldiers as part of an agreement between the two countries. The statement said a seizure incident contravened agreements signed by both countries.
However the UAE in a statement accused security forces of holding those on the plane "at gunpoint", and said the cash had been allocated to support the Somali army and trainees.
"The current Somali government ... is creating unnecessary tensions with a friend and an ally who supported the stability and security of Somalia during its hardest phases," tweeted UAE state minister for foreign affairs Anwar Gargash.
"We call for wisdom and reason."
Just days later, on Wednesday, Somalia's defense ministry announced it was taking over the management of hundreds of Somali troops who had been trained by the UAE.
The UAE has been running a military camp in Mogadishu where it trains Somali soldiers, who are also paid by Emirati officials.
"As a government, our responsibility is to take care of our armed forces and pay their wages and not to delegate that responsibility to others. We thank the UAE for the training and relentless support it provided," Defense Minister Mohamed Mursal told a local news agency.
Experts describe the bloated and largely ineffective Somali army as more a collection of clan militias, with various international militaries providing poorly-coordinated training to different units.
The security of the country, battling the Al-Qaeda-linked Shabaab extremists, has largely been propped up by AMISOM, the African Union peacekeeping force, which is due to withdraw by 2020.
WAM said the UAE has been paying the wages of 2,407 soldiers in addition to building training centers and a hospital. It said the UAE is supervising a counter-piracy maritime police force in Somalia's semi-autonomous region of Puntland.
Diplomatic tensions first spilled into the open in March after the Dubai-based DP World gave Ethiopia a 19-percent stake in the Berbera port in breakaway Somaliland.
Lawmakers in Somalia, which also has a history of animosity with Ethiopia, adopted a resolution accusing the company of having "intentionally violated the sovereignty of Somalia".
The UAE is also building a military base in Somaliland, a breakaway region of Somalia whose independence is not recognized by Mogadishu.
The 10-month Gulf crisis pits Saudi Arabia, the UAE, Egypt and Bahrain against Qatar -- which has been accused by its rivals of fostering close links with Tehran and supporting terrorist groups. Qatar denies the charges.
With close geographic, political, economic and cultural ties with the Gulf, observers warn the Horn of Africa is facing heightened instability as countries come under pressure to pick sides while Arab powers jockey for political influence.
Somalia has not had an effective central government since the 1991 overthrow of President Siad Barre's military regime which ushered in decades of anarchy and conflict.
Abdi warned the Gulf crisis could have a "serious destabilizing impact on Somalia."
"There's no doubt that the Gulf crisis has spilled over into the Horn. Now countries which are strong can manage this war, but Somalia is very vulnerable and very weak," he said.