By Richard Lough
MOGADISHU, April 25 (Reuters) - In a sign of growing optimism that Somalia is winning a struggle against pirates and al Qaeda-linked insurgents, Britain opened an embassy on Thursday in a set of four metal cabins at Mogadishu airport.
It was the first such move by a Western power since Somalia began to emerge from more than two decades of conflict. Turkey and Iran are among others vying for influence in the Horn of Africa country, with growing commercial ties and diplomatic missions already up and running.
"It is a symbol of our confidence and belief in the future of Somalia," said British Foreign Secretary William Hague, who flew in on an unannounced visit to watch the Union Jack flag hoisted above the cabins, generator and satellite dish within the airport perimeter fence.
"This is a sign of where Somalia is now heading to," said Somali President Hassan Sheikh Mohamud.
"Somalia is going back to the international arena," he added, expressing hope that other Western states would follow suit.
The country is enjoying a delicate recovery but remains heavily dependent on others for its security. An African Union military offensive has driven weakened al Shabaab insurgents from bases in Mogadishu and other cities, and piracy in the strategic sea lanes off Somalia is at an all-time low, thanks largely to a heavy foreign naval presence.
A stable Somalia would boost regional economies like Kenya and Ethiopia which have been rattled by their neighbour's insecurity, and would reassure Western capitals which have long worried Somalia provides a base for militant Islam to flourish.
The British government says now is "the best time in a generation for Somalia to get back onto the road to recovery." Britain will host an international conference in London on May 7 on ways to bolster security, impose the rule of law and rebuild the nation.
At the new embassy, due to be fully operational from late July, diplomats will live and work for a few weeks at a time in rotation behind two big blast walls, squeezed between the airport runway on one side and the Indian Ocean on the other.
Other countries with embassies in Mogadishu include Turkey, Libya, Ethiopia, Sudan, Yemen and Iran.
Britain's previous diplomatic mission lies in ruins: it closed in 1991 as a civil war broke out that led to first warlords and then Islamist militants stepping into the political vacuum.
Once written off as a failed state, Somalia now has its most legitimate government for decades since Mohamud's election in September. But the government still struggles to exert influence beyond the capital.
Foreign diplomats say they are spending more time in Somalia and will not be far behind the growing number of U.N. officials and aid workers slowly moving to Somalia from Kenya, where many organisations have been running their Somali operations. (Editing by Edmund Blair and Mark Trevelyan)