Fighting between police and soldiers at the Mogadishu police academy killed at least 24 people today, as thousands of civilians fled the Somali capital fearing a government offensive against rebels.
Islamist insurgents also fired mortar shells at the presidential palace.
The failed Horn of Africa state has had no effective central government for 19 years and the UN-backed administration of President Sheikh Ahmed Sharif controls just parts of the city.
"The death toll may rise because we have not yet reached some of the districts where shells also landed," Ali Muse, coordinator of the city's ambulance service, said.
A nurse at Medina Hospital said at least 40 wounded people had been rushed there, five of whom died of their injuries.
Witnesses said at least one civilian had also been killed in the crossfire.
Western security agencies say Somalia has become a safe haven for militants, including foreign jihadists, who use it to plot attacks across the region and beyond. Fighting there has killed at least 21,000 people since the start of 2007.
Witnesses said thousands of residents were leaving the capital, fearing the start of a government offensive that has been threatened for weeks.
Reuters