Somalia: PM Mohamed Abdullahi Mohamed resigns
Somalia's prime minister says he has resigned, following an agreement between the president and parliament to remove him from office.
Mohamed Abdullahi Mohamed had initially refused to step down, but will now go "in the interest of the Somali people".
His removal was part of a UN-backed deal that extends the mandates of the president, the speaker and deputies to August 2012.
Somalia has been without an effective central government since 1991.
Islamist militants control large parts of southern and central Somalia.
Mr Mohamed, also known as "Farmajo" said: "Considering the interest of the Somali people and the current situation in Somalia, I have decided to leave my office.
"I would like to thank my cabinet who have done a lot to help improve security and standards of governance in Somalia."
Last week, Mr Mohamed told the BBC he would not quit because only parliament had the power to oust him.
He said he had the support of the Somali people to stay in office.
There were protests in the capital, Mogadishu, rejecting the deal to remove the prime minister.
Under the deal signed in Uganda, the mandates of President Sheikh Sharif Ahmed, speaker Sharif Hassan Sheikh Aden and the deputies were extended until 20 August 2012, when new elections will be organised.
The president and the speaker had been in conflict over what would happen when the current administration's mandate runs out in August.
Mr Aden had said he could not work with Mr Mohamed and his departure was a condition of the deal.
Somalia has been without an effective central government since the fall of the Siad Bare regime in 1991, as rival factions constantly fight for power.
Foreign donors have been pushing rival factions to resolve their differences, and focus on defeating the Islamist threat.
The US believes that Somalia is a haven for al-Qaeda activists in East Africa, and has carried out several air strikes in the country to kill militants.