The US' decision to redeploy 500 troops to Somalia to help in the fight against militant Islamists is a clear sign of its support for new President Hassan Sheikh Mohamud.
The redeployment came after former US President Donald Trump ordered the withdrawal of the troops in December 2020 following years of strained relations with his predecessor Mohamed Abdullahi Mohamed "Farmajo", who was voted out of office by Somalia's lawmakers.
The US considered him to be a failure both in terms of governance and the campaign against Islamist militant groups al-Shabab and the much smaller Somali branch of the Islamic State (IS) group.
The announcement of what US Africa Command (Africom), describes as a "small, persistent US military presence" will come as a relief to Somalis who have experienced a surge of Islamist attacks since their departure - and to the US troops in neighbouring Djibouti who went in and out of Somalia to fill the security vacuum created by Mr Trump's decision.
According to The Africa Centre for Strategic Studies, the number of al-Shabab attacks rose from 1,771 to 2,072 in the year following the US pull-out, an increase of 17%.
The number of battles with the security forces went up by 32%. Last month, security officials said that about 450 al-Shabab fighters attacked an African Union base in southern Somalia, killing at least 40 Burundian soldiers.
United Nations experts have described al-Shabab as al-Qaeda's most powerful and wealthy affiliate. They estimate it has as many as 12,000 fighters and an ability to raise a monthly revenue of about $10m (£8m).
"Having American troops back on the ground in Somalia will make a big difference," says Samira Gaid, the executive director of the Hiraal Institute, a Mogadishu-based think tank focusing on security issues.
"It will not win the war but it will give the new administration space to set its security priorities."
As well as training, advising and equipping what Africom describes as "partner forces", the US military will have standing authority to target about a dozen al-Shabab leaders.
A previous campaign of US air strikes disrupted the group's activities, preventing senior militants from moving around and making it more difficult for al-Shabab infantry to carry out big attacks.
Some are sceptical about the return of the US military, highlighting that ordinary people have become victims of US drone attacks.
"Civilians have been killed in US airstrikes," says Halima Ahmed, a university student whose father was blown up in an al-Shabab suicide attack in September 2021.
"Cutting the head off the snake will only produce more snakes," she says, in reference to targeted killings of militant leaders.
'Sinister' US-trained commandos
In some cases, the US has instructed and equipped soldiers only to have them turn on each other.
In December 2021, an American-trained counter-terrorism force in the semi-autonomous region of Puntland split apart.
The two sides started fighting using weapons supplied by the US. More than 20 people were killed including children.
Another problem is that the US is not the only foreign country training and equipping the Somali security forces.
On a recent trip to Somalia's capital, Mogadishu, my guide pointed out soldiers and police wearing a bewildering number of different uniforms, carrying a wide assortment of weapons.
The US-trained elite commandos, known as the Danab or Lightning Brigade, are the most sinister. They often wear black balaclavas, adopting menacing poses with their big guns.
The Gorgor, or Eagles, learn their skills in a Turkish base in Mogadishu, its largest overseas military facility.
The UAE, Qatar, the UK, the European Union, Eritrea, Uganda, Kenya, Djibouti and others have also been involved.
This has led to a lack of coordination within the security forces. In some cases, troops trained by a particular country become aligned with a particular political group.
In April 2021, fierce fighting erupted between different factions of the security forces in Mogadishu sparking fears of a return to the catastrophic civil war of the 1990s.
The line between the regular army and political and clan-based militias is very thin. A soldier can act in the interests of the country as a whole on one day, and his or her particular clan or political group the next.
'Preferring' the US to China and Russia
In addition to redeploying troops to Somalia, the US has cast its gaze northwards towards the self-declared republic of Somaliland, which broke away from Somalia 31 years ago but has not been recognised internationally.
"In March, we were invited on what turned out to be a very productive trip to the US," says Somaliland's Foreign Minister Essa Kayd.
"A key focus was closer engagement on security and intelligence."
Two months later, the US reciprocated, despatching to Somaliland its top military man in Africa, the Africom commander, Gen Stephen Townsend.
Mr Kayd could not be drawn on the general's visit to the port city of Berbera, which included a viewing of the airport's four-kilometre-long runway built by the Soviet Union during the Cold War.
Rumour is rife in Somaliland that America is planning to build a military base in Berbera.
"All I can say right now is that the US visits will become more frequent," he says.
"We expect help in training our security forces and coast guard. Lots of superpowers, including China and Russia, are interested in establishing a footprint in Somaliland but we prefer the US because of our shared values."
According to Africom, the purpose of the general's visit was "to assess potential operating locations to be able to prepare for contingencies, exercise readiness or adjust force posture as needed".
There are plenty of reasons for the US to be interested in Somaliland.
The territory is in a highly strategic location. Its 800km (500-mile) coastline stretches along one of the world's busiest shipping routes.
Its tiny next door neighbour, Djibouti, is chock-a-block with foreign military bases, including Chinese and American ones.
Berbera offers an attractive alternative. It is close to some of the world's most unstable places, including Yemen, Somalia and Ethiopia, which has been a key US ally in the 'War on Terror' but is now wracked by internal conflict.
"Our small unrecognised country is doing the whole world a favour in terms of keeping it safe," says Mr Kayd. "We are a beacon of stability, standing guard in a turbulent region."
The US will have to tread carefully if it is serious about engaging more closely with Somaliland. Any such move is likely to anger Mogadishu which sees the territory as an integral part of Somalia.
But in terms of trying to improve stability in the volatile Horn of Africa and Red Sea zone, winning the war against al-Shabab and keeping up with its global rivals, the US has no choice but to focus on them both.
“WATCH: The latest videos from the Star”