Iran said it would set up an embassy in Mogadishu and Turkey promised to rebuild Somalia's parliament building, as the two neighbors, at odds over Syria, vied for influence in the Horn of Africa country.
Somalia has been mired in violence, Islamist militancy and grinding poverty since warlords toppled military dictator Mohamed Siad Barre in 1991, leaving the country with no effective central government for two decades.
But security has improved in the last 18 months with al Qaeda-linked militants losing more territory under their control under pressure from African Union and Somali forces.
The country is looking to foreign donors to help rebuild its ravaged economy after decades of conflict.
Tehran's move to open an embassy followed Turkey's decision to set up its embassy in Mogadishu last year.
The two states are at odds over the conflict in Syria, and it was not immediately clear if the two foreign ministers had met on the sidelines in Mogadishu.
Sunni Muslim Turkey backs the largely Sunni rebels who are mired in a civil war against President Bashar al Assad's forces, who are mostly Alawite, an offshoot of Shi'ite Islam, the dominant religion in Iran.
Shi'ite Iran's Foreign Minister Ali Akbar Salehi said his country was keen to stand by the Somali people, but Tehran is also seeking to counter the influence of Western countries and its Sunni neighbors by extending its reach to parts of majority Muslim African countries.
Salehi told reporters after meeting Somali President Hassan Sheikh Mohamud that apart from the embassy, his country would also open a new clinic.
"(Iran) will do its best so that Somalia will make up for the past 20 years of crisis that it has gone through," he said.
It was not immediately clear when the embassy would open.
Previously, Somalia had only five functioning embassies operating in the country: Djibouti, Sudan, Libya, Yemen and Ethiopia. Most other countries tend to handle Somali operations from neighboring Nairobi.
While security has improved in Mogadishu, the militants have been launching guerrilla-style attacks.
The four-year insurgency waged by al Shabaab left Mogadishu in ruins. Turkey has taken a leading role in the redevelopment of the city, as it seeks to boost its profile in Africa and promote itself as a model Muslim democracy.
Turkish Foreign Minister Ahmed Davutoglu said his country would rebuild the parliament building after which, he said, "We shall construct streets in Mogadishu and other government buildings."
Turkish Airlines has operated regular flights to Mogadishu since March.
(Writing by Yara Bayoumy; Editing by James Macharia and Michael Roddy)