Somalia's President Mohamed Abdullahi Farmajo has suspended the prime minister, who is facing allegations of involvement in the theft of land.
Mohamed Hussein Roble accused the president of trying to stage a coup, and said he would continue in office.
He urged the security forces to take orders from him rather than Mr Farmajo.
Troops loyal to the president earlier failed to block Mr Roble from entering his office in the capital Mogadishu, the prime minister's allies said.
The two men have been involved in a long-running power struggle, raising fears of further instability in Somalia.
The US embassy in Somalia urged the leaders "to refrain from provocative actions, and avoid violence".
Somalia has not had an effective central government since the overthrow of long-serving ruler Siad Barre in 1991.
The country is marred by disputes between rival politicians and clans. It is also battling an insurgency by al-Shabab, an al-Qaeda affiliate.
Mr Farmajo's term officially ended in February but was extended because of disagreements over how to choose a new president.
A complex election for parliament, which involves clan elders choosing MPs, has been under way since November. It was supposed to have concluded by 24 December but the deadline was missed.
The two leaders have accused each other of undermining the elections.
Mr Farmajo said he was suspending the prime minister pending the outcome of an investigation into the corruption allegations.
Mr Roble was recently accused of being involved, along with other officials, in the misappropriation and theft of military-owned land in Mogadishu. He denied the allegation.
In a tweet after Mr Farmajo's statement, the prime minister's office said he was carrying on with his day-to-day duties "as usual", and he remained committed to an "acceptable electoral process that culminates in a peaceful transfer of power".
Mr Roble later told a press conference that the president was attempting to carry out a coup "against the government, the constitution, and the rules of the country".
"I order all of the armed forces to directly take orders from the government... the office of the prime minister," he said in a statement broadcast live on Somali National TV.
The two leaders first clashed in April when Mr Farmajo extended his term in office, resulting in a stand-off between troops loyal to the two men in Mogadishu.
The pair clashed again in September when Mr Farmajo stripped Mr Roble of his power to hire and fire officials, but later reinstated them.
Latest Stories
-
Dreams FC denies allegations of attempting to sign Najeeb Yakubu
35 mins -
Election 2024: ‘Right to free and fair elections non-negotiable’ – Akufo-Addo
40 mins -
Kurt Okraku took out my passport from the U23 squad that travelled to Japan – Najeeb Yakubu alleges
51 mins -
Where hope fails: Ghana’s decaying home for the destitute
1 hour -
NDC Mining Committee for 2024 campaign refutes allegations of recruiting thugs for elections
1 hour -
Traction Control: A lifesaver with an off switch? Here’s why it exists
1 hour -
I don’t need anyman to woo me with money – Miss Malaika 2024 winner refutes pimping claims
1 hour -
”Kurt Okraku sabotaged my national team career because I refused to sign with Dreams FC” – Najeeb Yakubu
1 hour -
Businesses urged to leverage Generative AI for enhanced customer engagement
1 hour -
MultiChoice Ghana partners with Ghana Hotels Association to elevate guest entertainment
2 hours -
Bawumia’s music streaming app or Mahama’s pay-per-view TV channel?
2 hours -
Karpowership Ghana empowers 40 Takoradi Technical University students with scholarship
2 hours -
We expect significant reduction in prices of petroleum products in coming weeks – CEO AOMC
2 hours -
Betway Africa offers once-in-a-lifetime ‘Play-on-the-Pitch’ experience at Emirates Stadium
2 hours -
I coined the term ‘hype man’ in Ghana – Merqury Quaye
2 hours