Baidoa: Somali Prime Minister Ali Mohamed Gedi resigned in parliament on Monday, ending a political feud with the president, witnesses said.

"Today I want to state that I am going to resign, that I am leaving the government," Gedi told parliament in the south-central trading town of Baidoa.

The decision comes after a lengthy political feud between Gedi and President Abdullahi Yusuf, officials and diplomats said.

The Gedi-Yusuf split had weakened the government as it faced an Islamist-led insurgency this year.

It had also frustrated foreign backers including the United Nations and United States.