“Considering the interest of the society and in compliance with the Kampala accord, I decided to quit to compromise for the national interest,” Mohamed told reporters in the capital, Mogadishu.
The accord, which also ended the prime minister’s mandate, stipulates that elections for president and speaker of parliament will have to take place before 20 August, 2012.
Mohamed, a Somali-American, has served as prime minister for about the past six months. He previously taught at a community college in New York.
The president has named Abdiwali Mohamed Ali as caretaker prime minister until a new appointment is made.
Somalia’s transitional government, which was set up in 2004 in Kenya, owes it survival to the international community.
It has been weakened by in-fighting between its leaders which has worsened as the end of the mandates approached.