Britain appointed its first ambassador to Somalia for 21 years on Thursday during a visit to the capital of the anarchic Horn of Africa nation by Foreign Secretary William Hague.
It was the first visit to Mogadishu by a British foreign minister since 1992 and comes ahead of a conference in London this month to discuss measures to tackle instability in Somalia and piracy off its shores.
Britain's new envoy to Somalia, Matt Baugh, will remain based in Kenya's capital Nairobi until security conditions permit the opening of an embassy in Mogadishu.
Somalia descended into chaos after dictator Mohamed Siad Barre was ousted in 1991 and a Western-backed transition government has been battling local Al-Qaeda-linked insurgents al-Shabaab for the past five years.
At the moment, there are six diplomatic missions in Mogadishu, representing Djibouti, Ethiopia, Libya, Sudan, Turkey and Yemen. The UN's special envoy to Somalia also moved to Mogadishu last month.
An African Union force (AMISOM) in Mogadishu has helped drive al-Shabaab out of the capital, but much of the south of remains in the hands of the rebels. Kenya and Ethiopia have both sent forces into Somalia to battle al-Shabaab.
Analysts say the departure of al-Shabaab from the capital, combined with the offensives by neighbouring states, has opened a window of opportunity to defeat the hardline militants, although Mogadishu remains prone to almost daily bomb attacks.
"We need to step this up. We are not complacent about it," Hague said, describing Somalia as "the world's most failed state".
"For the security of the UK, it matters a lot for Somalia to become a more stable place," he said. "Some progress has been made on this, partly because of the progress of the AMISOM force."
Al-Shabaab struck Uganda in 2010, killing nearly 80 people watching the soccer World Cup final. The militants have launched a series of grenade and roadside bomb attacks in Kenya since it sent troops into Somalia in October.
Britain has warned it is only a matter of time before Islamist militants trained in Somalia strike on British soil.
"One of the objectives of our conference in London is to strengthen counter-terrorism cooperation to make it easier for countries in this region to disrupt terrorist networks, to disrupt their financing and the movement of potential terrorists," Hague said.
Hague's visit came as Kenyan and Somali troops seized two towns in southern Somalia from al-Shabaab in a bid to consolidate control of border areas, a Kenyan military spokesman said, ahead of an eventual push on rebel strongholds.
Kenyan ground forces entered Hosungow, near the Kenyan border, on Wednesday after air strikes over the weekend weakened the al-Shabaab rebel group's defensive positions, Emmanuel Chirchir told Reuters.
"Capturing Hosungow is important for denying Shabaab their rearguard operations," Chirchir said on Wednesday.
While Kenya's near four-month military campaign inside Somalia has dislodged al-Shabaab from several towns in the border area, the militants have retreated into the bush and regularly ambush the Kenyan forces on key supply routes.
Al-Shabaab denied Chirchir's claim several insurgents had been killed in a battle for Hosungow and said its fighters were based outside the town at the time Kenyan troops advanced.
Further south towards Somalia's Indian Ocean coastline, Somali government troops regained control of Badhaadhe late on Wednesday. Kenyan troops were stationed within "firing distance".