The al Shabaab militants, who are allied to al Qaeda, were forced out of most of the city last year but have kept up sporadic bomb and suicide attacks.

“It was heavy fighting last night ... Two al Shabaab dead bodies are lying here,” said Captain Ndayiragije Come, a spokesman from the Burundi contingent of the AU’s AMISOM peacekeeping mission in Somalia.

“From our side two were injured. They were also shelling our position - they missed their target,” he added.

Witnesses said shelling from the fighting hit two houses, killing at least seven civilians, four of them from one family.

“A big shell landed on a house made of iron sheets. The father, mother and their two sons died, only two children survived with injuries,” resident Abdi Gaas told Reuters.

“Another shell landed on a nearby house. A mother and her son died. The fragments of the shell killed a boy in another house, we are now burying 7 people,” he added.

A Reuters reporter saw the dead bodies of seven civilians.

No one was immediately available to comment from al Shabaab.

The rebel group has waged a bloody five-year campaign to topple Somalia’s Western-backed government and impose its harsh interpretation of Islamic law (sharia).

The rebels continue to hold swathes of central and southern Somalia but are being squeezed out of some areas by Kenyan and Ethiopian troops, which have launched incursions inside Somalia in support of the beleaguered government.

Somalia has been mired in chaos since warlords toppled dictator Mohamed Siad Barre in 1991.

The overnight fighting took place in Mogadishu’s northern Daynile district, the rebels’ last position after they withdrew from the capital last year, under pressure from AMISOM and Somali government troops.

Daynile has been the scene of some of the heaviest fighting in Mogadishu. In October, the AU said it had lost 10 Burundian peacekeepers in fighting there, but Reuters witnesses said they saw a significantly higher number of bodies.

The African troops are keen to keep their hold on the district to help them launch an offensive against the nearby rebel strongholds of Elasha, Lafole and Afgoye.