Somali government forces and Ethiopian troops have shelled areas of Somalia's capital Mogadishu after their positions came under fire from insurgents.
Dozens have been killed or injured in similar attacks this year
At least 12 people, mostly civilians, were killed in the exchanges - the heaviest since the government took Mogadishu from Islamists last year.
Unknown gunmen launch almost daily attacks in the city.
Some Islamists, who last year were controlled much of southern Somalia, have vowed to start a guerrilla war.
The government blames the attacks on Islamist fighters and on Monday set up a special unit to target "terrorists".
Dozens of people have been killed during attacks this year.
Both the insurgents's mortars and the government's artillery response landed on residential areas, causing civilians casualties.
Insurgents attacked the city's main sea port, the presidential palace known as Villa Somalia and two government and Ethiopian military barracks with mortars during the night, says the BBC's Mohammed Olad Hassan in Mogadishu.
Troops responded with artillery leaving at least 10 civilians dead, including women and children, and at least 40 others wounded, witnesses and local residents said.
Several houses were also destroyed, although details are still emerging.
"Four people including my four-year-old son have died, when four mortars hit our area," said southern Mogadishu resident Mohamed Abdi Farh.
Doctors and nurses at two of Mogadishu's main hospitals said more than 40 people were taken to hospital only on Tuesday morning.
"About 33 people, six of them children, were brought here, all of them this morning because they had no access to the hospital in the night," said Medina Hospital director Sheikh Doon Salad Ilmi.
Hundreds of Mogadishu residents poured onto the streets in search of concrete buildings for cover as the pop of artillery gunfire and the boom of explosives echoed across the capital, our correspondent said.
"We spent the whole night under this concrete wall because I did not know where to run," said Ruqiyo Madobe Ahmed, 34, a mother of four.
"From 2000 (1700 GMT) to dawn this morning, we have remained alert, fearing that the attacks could escalate," said southern Mogadishu resident Jamaal Abdi-nasir.
Residents say it was the most horrific night they had had since the government troops took over control of Mogadishu.
"In terms of the extent of the explosion and the number of attacks, I think we have experienced the worst violence," said Hodan Wali Nuure, a mother of a six-year-old boy, who was wounded by shrapnel from a nearby explosion.
The African Union is planning to send a peacekeeping force to Somalia to replace the Ethiopian soldiers who have started to withdraw after helping the government oust the Islamists.
After 16 years without an effective national government, Mogadishu is awash with weapons.