The attack was part of an armed campaign by government forces and African Union peacekeepers in response to a recent surge in gun and bomb attacks in Mogadishu by militias, primarily the al Qaeda-linked al Shabaab group.

"At least 14 people, mostly militia(men), died in the fighting this morning. The government's aim is to secure the city," Major Abdullahi Farah, a senior police officer, told Reuters.

It was not clear if the militants targeted on Friday were members of al Shabaab, but Farah said the group was colluding with other militia groups in the city.

Officials of al Shabaab, whose fighters have recently targeted legislators as well as attacking the presidential palace, were not immediately available for comment.

Ahmed Hussein, a Mogadishu resident, said he was awakened by mortar rounds on Friday, and that the militiamen appeared to be moving back under the peacekeepers' attack.

"The death toll is sure to rise," Hussein told Reuters from the Madina suburb which has residential homes, markets and schools.

Another resident said peacekeepers had attacked three politicians' houses.

Omar Mohamed, a legislator and former warlord, said his house was attacked by tanks and troops. "I do not know why (they).. attacked me.... I am fighting and defending myself," he told Reuters.

A second resident, Siyad Mowlid, said most of the militants under attack had managed to flee further into Madina.

Al Shabaab controlled large sections of Mogadishu until 2011 when African forces drove them out. But the militants have since staged guerrilla attacks in parts of the capital.

As part of the crackdown by the government, three men were executed by firing squad on Aug. 3 after a Somali military court found them guilty of killing civilians in a series of recent attacks in the country blamed al Shabaab.

Somalia has faced turmoil for more than two decades since the fall of dictator Mohamed Siad Barre tipped the country into chaos.