Somali President Hassan Sheikh Mohamud told a London conference that international support was needed as his country takes its first democratic steps in more than 20 years.
Somalia last year formed a central government for the first time since the 1990s but key territory was seized from Somali militant group al-Shabaab and security is fragile.
"Despite being militarily defeated, al-Shabaab have melted into society and begun a new phase of insurgency and a campaign of terror," he said.
British Prime Minister David Cameron said recent al-Shabaab attacks on Mogadishu were "tragic and despicable," noting they serve as reminders of how much work is left in Somalia.
Mohamud said the first stages of growth are always the most hazardous. While evolution should be a Somali-owned process, no country has ever recovered from such a history without international support, he said.
"Winning the war in Somalia has been proved," he said. 'Winning the peace in Somalia will take patience and great skill."