Heavily armed Islamist fighters fought their rivals from the so-called Alliance for the Restoration of Peace and Counter-Terrorism (ARPCT) before taking control of Balad township around 30km north of the Somali capital.

Medical workers saidthat the 12, mostly militiamen, who were killed in Balad and the nearby village of Basra, brought the death toll from clashes to 31 in four days.

Yusuf Hagaley, a medical worker in the town, said: "The counted dead bodies were found in the town and there were other [casualty] figures from small clinics."

Witnesses said ARPCT commanders fled to the town of Jowhar, about 60km to the north.

With control of Balad, the Islamists have weakened the warlords' allaince that has controlled the country since Mohamed Siad Barre was toppled in 1991.

Since the war erupted in February, at least 244 people have been killed and more than 1,500 injured, many of them civilians.

Somalia's largely powerless transitional government has blamed the alliance and the United States, which is believed to be backing it, for the current fighting, the bloodiest for 15 years.