Somali MPs have voted the country's prime minister, Abdi Farah Shirdon, out of office following a disagreement with President Hassan Sheikh Mohamud.

Announcing the result of the vote, Mohamed Osman Jawari, speaker of the Somali parliament, said on Monday that 184 MPs out of 250 present voted for the impeachment motion.

Shirdon will remain in office until Mohamud nominates a new prime minister, who will then have 30 days to appoint a new cabinet, Jawari said.

Shortly before Jawari announced the results of the motion, Shirdon, speaking in the capital Mogadishu, said: "Some ministers in the cabinet are behind the current political instability. They think the prime minister could be easily ousted so they could keep their positions."

Mohamud has not said when he will appoint a new prime minister, who in turn will have to appoint a new cabinet which will have to be approved by parliament.

The parliament vote came after disputes emerged between Shirdon, a former businessman who has been prime minister since October 2012, and Mohamud, the Associated Press news agency said.

It reported quoting legislators that Shirdon refused to put Mohamud's picks into his cabinet, which was scheduled to be reshuffled.

The MPs had been debating the no-confidence motion against Shirdon for the past two days. More than 165 MPs had signed the motion, which was brought to parliament on Saturday.

Nicholas Kay, the UN representative to Somalia, said the overthrow of the prime minister by vote from the parliament showed that Somalia's institutions are "coming of age".

"The UN is here to support their development, and looks forward to working constructively with the new administration. Outgoing Prime Minister Shirdon had worked hard to promote growth and progress and played an important part in creating the New Deal Compact between international partners and Somalia," Kay said.

Previous Somali governments have been plagued by infighting between presidents and prime ministers. Shirdon is the fifth prime minister in six years Somalia has had.

Somalia's weak, UN-backed government - which sits in place in large part because of the security provided by African Union troops - controls only small parts of the country and continues to struggle to provide security and battle corruption.

Mogadishu, though, is much better off today than the years 2006-2011, when the armed anti-government group al-Shabab controlled much of it.

Follow Hamza Mohamed on Twitter: hamza_africa

Source: Al Jazeera and agencies