Turkish President Recep Tayyip Erdogan has launched a number of development projects in Somalia sponsored by his government, including an airport terminal in Mogadishu, during a visit to the country.
Hundreds of soldiers and police officers shut down much of the capital's streets, where on Thursday five people were killed in a suicide attack on a hotel housing the Turkish delegation. Nobody from the delegation was harmed in the incident.
Erdogan, on his second visit to Somalia, was accompanied by his wife, daughter and ministers.
Somali President Hassan Sheikh Mohamud lauded Turkey for investing in his country, despite challenges including insecurity caused by the armed al-Shabab group, which is allied to al-Qaeda.
In a statement welcoming the visit, Mohamud said Turkish aid had been a "force of nature" for Somalia.
"Turkey did not hold back, waiting for stability before it invested. Instead, it invested to achieve it," he said.
"Where other international partners chose to plan their interventions from elsewhere, Turkey put its people on the ground in Somalia."
Erdogan praised the "major developments" seen in Somalia, after he was welcomed at the new Turkish-renovated airport by his counterpart.
The visit to Somalia ends Erdogan's Horn of Africa tour, which has included visits to Ethiopia and Djibouti, a key port on the Gulf of Aden and the entrance to the Red Sea.
Al-Shabab has long threatened Turkish workers and aid agencies in Somalia, accusing them of spreading secularism.
A Turkish security official and a Somali student were killed in a 2013 July attack on the Turkish consulate and relief mission in Mogadishu.
Al-Shabab fighters have in the past three years lost large swathes of territory and towns to African Union forces and Somali government troops, and their leader was killed in a US air strike in September.
However, the group still remains potent and continues to carry out attacks.