"Hundreds of well-armed insurgents came to our district with minibuses and pick-up trucks and immediately they started firing towards the government troops and an African Union base," Mogadishu resident Abdi Haji Ahmed said.

"We have been ducking under our concrete balcony for hours."

Another resident said: "We did not sleep since yesterday because of the huge numbers of shells targeting this neighborhood. We call upon God to end our ordeals."

Rebels 'provoked'

Al-Shabab spokesman Sheik Ali Mohamud Rage said his forces retaliated against the African Union troops for earlier rolling into rebel-controlled areas.

"They provoked us by coming into our areas, so we have a right to attack them in their bases," Rage said.

The government and African Union had no immediate comment.

The attacks came a day after 40 people, mostly civilians, died as the two sides sought to gain ground in strategic towns.

Violence and anarchy

The fighting began on Thursday in Bula Burte, about 210km north of the capital, when government soldiers moved into the town controlled by al-Shabab.

The US says al-Shabab, which is fighting to remove the current transitional federal government and impose sharia, or Islamic law, has ties to al-Qaeda, a claim the group denies.

About 4,000 African Union peace keepers from Burundi and Uganda are stationed in Mogadishu to protect government installations.

They have occasionally clashed with al-Shabab fighters as they try to ward of the fighters' advance.

Somalia has been ravaged by violence and anarchy since warlords overthrew Mohamed Siad Barre, a former dictator, in 1991, before turning on each other.