The president of Somalia has backed down on his decision to sack the country's prime minister.
In a statement, the president said he has asked the prime minister to continue his duties.
Internal splits in the government erupted first with the resignation of the parliamentary speaker.
President Sheikh Sharif Ahmed then dismissed both the prime minister and his cabinet in an apparent attempt to establish his own authority.
The latest twist in Somalia's political turmoil comes at time when the UN-backed government is battling an insurgency against Islamist extremists.
President Ahmed said he decided to keep Prime Minister Omar Abdirashid Sharmarke after consulting lawyers - who said the move would have been unconstitutional.
Analysts say the row has severely weakened the president's credibility, and the UN's, which had backed him.
On Friday, donors are expected to take part in a major UN-sponsored conference in Turkey to discuss future aid for Somalia.
Correspondents say the administration of President Ahmed has failed to bring either unity or security as he promised when he took charge at the start of 2009.
The government rules only a few strategic square kilometres of the capital.
A 5,000-strong African Union peacekeeping force is all that stands between it and the insurgents who now dominate most of the rest of southern and central Somalia.
Some analysts believe the on-going power struggle could trigger the government's complete collapse and hand the country to the Islamist rebels.
The Horn of Africa nation has not had a functioning central government since 1991.