African Union (AU) troops say they have driven Islamist al-Shabab militants out of their last stronghold in the north of Somalia's capital, Mogadishu.
"We control the whole of Mogadishu," AU Gen Fred Mugisha told the BBC. He said that Somali government forces also took part in the offensive.
One African Union soldier and eight civilians were killed in the fighting, reports say.
Al-Shabab still controls large swathes of south and central Somalia.
Gen Mugisha told the BBC: "[Transitional Federal Government of Somalia] forces, supported by Amisom (the African Union Mission in Somalia) - we have managed to push out al-Shabab from Mogadishu main city. As I am talking to you, we control the whole of Mogadishu main city, yes."
Amisom spokesman Lt Col Paddy Ankunda said the objective had been to push the al-Shabab forces out of mortar range of civilians.
"The outer north and eastern fringes of the city must still be cleared, but key ground and buildings are no longer under the control of the extremists," he said.
A former pasta factory used by al-Shabab as an operations centre had been captured, he added.
Al-Shabab still has a presence in the outlying district of Daynile, a BBC reporter in Mogadishu says.
"It has been a big achievement to remove [al-Shabab] from the city, and put an end to the fighting that disrupted so many lives," said Lt Col Ankunda. "But the challenge is now to protect civilians from the sort of terror attack we saw last week."
Al-Shabab said it carried out a bomb attack last week which killed more than 80 people.
The al-Qaeda-linked group retreated from most of Mogadishu in August, following an offensive by Amisom, but analysts had predicted that without a front line, the organisation was likely to begin carrying out more bombings, including suicide attacks.
Al-Shabab said both the August pullout and Monday's loss of ground were tactical moves.
"Allowing the Amisom troops to come to the pasta factory was just a trap planned earlier so that they spread out their troops," an al-Shabab official told AFP news agency.
Somalia has been without an effective central government since 1991 - the weak transitional government and Islamist militias are competing for control of the country.