There has been fierce fighting near the Somali capital Mogadishu after fighters from the Islamist militant group al-Shabab overran a key town.
Reports say at least four policemen and several civilians were killed when militants stormed Afgoye on Tuesday.
A spokesman with the African Union mission to Somalia later said the gunmen had been forced out, but this was not confirmed.
Witnesses said gunshots could still be heard into the night.
The African Union Mission in Somalia (Amisom) is supporting the Somali government in its fight against al-Shabab.
Residents said the attack on Afgoye, 30km (18 miles) from Mogadishu, started when militants detonated a car bomb outside a police post, killing four policemen.
People took cover in their homes as fighters appeared in parts of the town and clashed with Somali troops and African Union forces.
Police officer Abdukadir Ahmed told AFP news agency that at least 10 people, including civilians, had been killed as well as some of the attackers.
Afgoye is considered a strategic town as it sits on one of only two roads into the capital.
As the fighting raged, both sides said they had control of the town.
Amisom troops captured Afgoye town in 2012.
Somali militants attack key town of Afgoye near capital