A Somali dealer holds weapons looted from a former United Arab Emirates (UAE) military training camp during a Reuters interview in Mogadishu, Somalia April 25, 2018

A battle for access to seaports is underway in one of the world's unlikeliest places: Somalia, now caught up in a regional struggle between Saudi Arabia and the United Arab Emirates on one side, with Qatar backed by Turkey on the other.

At stake: not just the busy waters off the Somali coast but the future stability of the country itself.

Somalia has been at war for decades and until the last few years it has struggled to attract foreign investment. But rivalries in the nearby Arabian peninsula are resulting in serious inflows into Somalia.

A year ago, a company owned by the United Arab Emirates government signed a $336 million contract to expand the port of Bosaso, north of Mogadishu in the semi-autonomous Somali region of Puntland.

Less than a year before that, another UAE-owned firm took control of the Berbera port in the breakaway northern region of Somaliland and pledged up to $440 million to develop it. In March, Ethiopia took a stake in the port for an undisclosed sum.

At the same time, Turkey, an ally of UAE rival Qatar, is ramping up a multi-billion dollar investment push in Somalia. A Turkish company has run the Mogadishu port since 2014, while other Turkish firms have built roads, schools, and hospitals.

The rivalries have intensified since June, when the most powerful Arab states, led by Saudi Arabia and including the UAE, cut diplomatic ties with Qatar, accusing it of supporting Iran and Islamist militants.

That Middle Eastern feud is driving the desire to control the Horn of Africa and its waters, according to diplomats, businessmen, scholars and Somali officials.

Somalia is close to vital oil routes and its ports could also serve landlocked Ethiopia, which has a population of 100 million.

Gulf nations have had trade and religious ties with Somalia for centuries, but those relationships are now up in the air as new rivalries emerge.

Keep updated: Sign up to our newsletter Email * Please enter a valid email address Sign up Please wait… Thank you for signing up. We've got more newsletters we think you'll find interesting. Click here Oops. Something went wrong. Please try again later. Try again Thank you, The email address you have provided is already registered. Close

"Somalia has been caught in the middle of this effort to try to expand influence, commercial and military, along the coast," said Rob Malley, president of the International Crisis Group, a think-tank.

Saudi Arabia and the UAE increasingly view the Somali coastline - and Djibouti and Eritrea to the north - as their "western security flank", according to a senior western diplomat in the Horn of Africa region.

Qatar and Turkey, whose investments are almost all in Mogadishu, are focussed on supporting President Mohamed Abdullahi Mohamed. He and his chief of staff are widely viewed in Somalia and by western diplomats as loyal to Doha after receiving funds for their 2017 election campaign.

A Qatari official told Reuters Doha had provided $385 million in infrastructure, education and humanitarian assistance to the central Somali government.

The official said making deals directly with regional governments in Somalia, as the UAE has done, undermined the central government.

Somali finance minister Abdirahman Duale Beileh agreed.

"The Gulf region has a lot of money and if they want to invest in Somalia we welcome them with open arms," he told Reuters. "But it's a question of going through the right doors."

The federal government in Mogadishu has long been at odds with the semi-autonomous regions of Puntland and Somaliland. The latter operates virtually as an independent state and has for years sought to secede from Somalia, but has not won international recognition.

Detrimental effect

Less than a decade ago there was virtually no commercial interest in Somalia.

That began to change in 2011 when al Qaeda-backed al Shabaab militants retreated from Mogadishu. Months later, Turkey launched famine relief operations, opening the door for projects that now make it Somalia's biggest foreign investor.

The government hopes new investment, especially in infrastructure, can help the country rebuild.

Better tax collection is boosting government revenues, but this only covers public sector salaries. Huge amounts of capital are needed for roads, schools and other basics. Middle Eastern companies and charities could provide some of it.

However, the money could also destabilise the country further by deepening tensions between the central government, aligned with Turkey and Qatar, and Puntland and Somaliland, which both receive money from the UAE.

"These investments are having a detrimental effect on our political stability and worsening the relationship between our federal government and the regions," said former national security adviser Hussein Sheikh-Ali.

"This could cause a constitutional crisis that only al Shabaab will benefit from."

The Gulf crisis has already deepened rifts in Somalia. The central government has stayed neutral, to the annoyance of the UAE and Saudi Arabia, which Puntland and Somaliland have backed against Qatar.

"Getting out of this mess is very difficult," Sheikh-Ali said. "Without unity we cannot."

The Somali presidency and the UAE government did not immediately respond to requests for comments.

Western nations fear the Gulf rivalries playing out in Somalia could sideline their multi-billion dollar, U.N.-led efforts to build a functional Somali army to fight Shabaab before the withdrawal of African Union peacekeepers in 2020.

Political crises between Mogadishu and the regional authorities are undermining government efforts to strengthen financial systems and embark on other core tasks of a state, diplomats say.

Trouble

The Gulf rivalry is also being felt on the ground in Somalia.

In mid-April, Somalia and the UAE ended military cooperation. Since 2014, the UAE had trained and paid the salaries of Somali troops in Mogadishu and built an anti-piracy force in Puntland. Hundreds of weapons were looted from the training centre in Mogadishu as it shut down.

This came after Somali security forces seized nearly $10 million flown in from the UAE to pay soldiers and temporarily held the plane which brought the cash. The UAE also closed a hospital that offered free care.

Last week Puntland officials travelled to Dubai to meet UAE counterparts and P&O, the state firm developing its port.

"Investing millions of dollars in Somalia at this critical juncture in history is very important for us," Puntland President Abdiweli Mohamed Ali said.

Similarly, Somaliland officials hosted UAE diplomats last week to discuss "enhancing bilateral ties".

"For Somalis themselves, this kind of geopolitical game of chess, where Somalia is solely a proxy conflict to the trouble in the Gulf, this is obviously bad news," said Harry Verhoeven, professor at Georgetown University in Qatar.