|Ahmed has been a prominent figure in Somalia since he began leading the UIC in 2004 [EPA]
Sharif Ahmed, 44, was voted in as president of Somalia in a parliamentary poll in January and pledged to restore some semblance of security to a country riven by internal conflict for years.
"My first priority is to bring peace to Somalia and I will serve the nation to the best of my ability," he said after taking power.
It was hoped that Ahmed would be able a unifying force, after all he had once been leader of the Islamic Courts Union, which had waged a bitter war against the country's weak transitional government.
But now it is his former allies in the al-Shabab and Hizbul Islam groups who are battling to bring down the government.
Considered a "moderate" Muslim, Ahmed was born in the Mahaday district, about 100km north of Mogadishu in 1964.
After attending Islamic schools in Somalia, he went on to study in Sudan and Libya during the 1990s before becoming a geography teacher in a Mogadishu secondary school.
He has said it was the kidnapping of a young student for ransom that drove him to set up a sharia court to rid the capital of banditry.
The Islamic courts union drew together more than a dozen sharia tribunals set up in the 1990s to restore a degree of law and order to the capital Mogadishu.
By the summer of 2006, the group had managed to unify Mogadishu, and under Ahmed's leadership, it had gained control of most of southern Somalia.
In its six months of rule, the movement was credited with bringing peace and stability to the region for the first time in 15 years, but was also criticised for strict religious practices.
Seeing the movement as a threat to both itself and the UN-backed transitional Somali government, Ethiopia entered its Horn of Africa neighbour in December 2006, forcing out the Islamic Courts.
Ahmed was forced to to flee and surrendered to Kenyan authorities on the border in January 2007, although he was released days later.
He returned to Somalia in November 2008 under UN-sponsored peace agreements with the transitional government signed in Djibouti in July and October 2008.
Under those deals, Ethiopian forces have pulled out of the country - a situation Ahmed has claimed credit for.
Seats in the Somali parliament were doubled to 550 in order to accommodate 200 members of Ahmed's Alliance for the Re-liberation of Somalia (ARS), and 75 other opposition figures.
Al-Shabab rejected the Djibouti agreement, allying itself with Hizbul Islam and vowing to topple Ahmed.