Somalia's President Mohamed Farmaajo on Thursday said he had suspended his Prime Minister Hussein Roble's powers to hire and fire officials.
In a statement to the media, Villa Somalia, Farmaajo's official residence in Mogadishu, said the the suspension of these duties will remain in effect until after elections are held.
According to the electoral calendar, elections will be conducted until October 10, but there have been delays on crucial parliamentary polls, suggesting the schedule may drag on.
Villa Somalia said Mr Roble had "deviated" from the mandate of the government and violated provisions of the Provisional Constitution of Somalia.
Mr Roble will no longer head the government and will have no powers to suspend or dismiss ministers, Villa Somalia said.
Abdirashid M Hashi, President Farmaajo's spokesman, said Roble had "not consulted with the President, and proceeded to issue decisions that were inconsistent with the laws and the constitution of the country," which was now being considered as incompetence on the PM's part.
He said the President had decided to act and save the country from a potential "political and security crisis".
Each minister in government will continue to perform his duties and will be responsible for the ministry's actions until after elections, he said.
"During this period, the various organs of the state shall continue to serve the people as necessary for the functioning of the government, in accordance with Article 102 of the Provisional Constitution."
The suspension marked a new height in the differences between two of Somalia's highest ranking leaders, which opposition leaders now fear could derail the electoral calendar.
Last month, Roble defied Farmaajo's orders not to engage with foreign entities until after elections.
The two leaders also differed following events surrounding the disappearance of Ikran Tahlil, a spy agent who went missing on June 26.
The National Intelligence Security Agency (NISA) says she was abducted and murdered by Shabaabs, but the militants denied the allegations.
Last week, PM Roble suspended NISA Director General Fahad Yasin, but hours later Farmaajo overruled him and reinstated the spy chief.
Roble ignored Farmaajo's statement and was waiting to preside over a ceremony within three days for his NISA boss nominee General Bashir Mohamed Jama to take office.
Instead, just a day after his reinstatement, Yasin resigned from the post of NISA director, which Farmaajo readily accepted. The president then appointed Yasin Abdullahi Mohamud as the new head of NISA. Mohamud was the commander of NISA operations in Banadir region (Mogadishu and surrounding locations) before the new appointment.
Farmaajo's appointee Mohamud wasted no time in taking over office while Fahad Yasin, who was in Turkey, joined the handover ceremony on Wednesday virtually and surrendered his powers.
That left General Jama, the man chosen by Roble to lead the spy agency, with no chance to go to NISA headquarters and take over the office.
Later, Roble sacked Internal Security Minister Hassan Hundubey, a decision Farmaajo nullified.
Both Farmaajo and Roble have cited articles in the provisional constitution in defending their actions.
The tiff has raised concerns among development partners and leaders of federal states.
Last week, Presidents Abdiaziz Hassan Laftagareen of South West state and Ahmed Abdi Karie Qoorqoor of Galmudug flew to the Somali capital Mogadishu in a peace-making role.
Their mediation failed, Somalia media reported, as the PM and president could not agree on how to investigate Ms Tahlil's disappearance.
Mr Roble had assigned a military court to investigate, but Farmaajo appointed a five-member committee to do the same job. Roble rejected the committee, leaving the actual investigation in limbo.
Farmaajo said elections must go on as planned, in accordance with the agreement of September 17, 2020 and the procedures for resolving the concerns raised on May 27, 2021, and the conduct of the bicameral elections.