Somalia's al-Shabab Islamist rebels have pulled out of all positions in the Somali capital of Mogadishu, government and rebel spokesmen say.
President Sheikh Sharif Ahmed declared the rebels defeated after they left overnight on trucks.
However, al-Shabab described the move as a "change of military tactics".
The conflict has hampered aid efforts in the famine-hit country, with the militia barring some aid agencies from central and southern areas it controls.
African Union peacekeepers and government forces have for years been contained to small areas of the capital but have recently been gaining ground.
The pull-out followed reports of gun battles in the capital on Friday night.
Sheikh Ahmed told a press conference: "The Somali government welcomes the success attained by the Somali government forces backed by Amisom [peacekeepers] who defeated the enemy of al-Shabab."
However, a spokesman for the al-Qaeda-linked rebels, Ali Mohamed Rage, told a local radio station there would be no withdrawal from other regions of southern Somalia.
"The retreat by our forces is only aiming to counter-attack the enemy. People will hear happy news in the coming hours," he said.
"We shall fight the enemy wherever they are."
A spokesman for the African Union peacekeepers in Somalia said the force was treating the rebel withdrawal with caution in case it was a trap.
Soldiers would not immediately deploy across Mogadishu, Lt Col Paddy Ankunda told the BBC.
Some analysts have suggested the Islamist insurgents withdrew because funding from the Arab world had dwindled and they had become militarily weaker.
Parts of the capital, where there are camps for displaced people, were last week among three areas newly declared by the United Nations to be suffering famine.
There are now a total of five famine zones in the country.
The UN says some 640,000 children are acutely malnourished in Somalia, while 3.2 million people are in need of immediate life-saving assistance.
- 5 August 2011