Mortar rounds and rockets hit Somalia's capital early Tuesday in a series of attacks that killed 12 people, including a 4-year-old boy, and wounded more than 40 others, doctors and witnesses said.

The violence, which erupted after mortar attacks on three Ethiopian and Somali government barracks, was among the worst since Somalia's government moved into the capital late last year. Somali troops, with the help of soldiers from neighboring Ethiopia, drove out an Islamic group who wanted to rule the country by the Koran.

The presidential palace and seaport were also targeted in attacks. Ethiopian troops returned fire with artillery and heavy machine-gun fire throughout the night.

Complete coverage is available in FOXNews.com's Africa Center.

Families have begun fleeing the city in recent days as the violence escalated.

"We cannot keep our children in this violent situation," said Yonis Nor, a father of eight as he left the capital with his family. "It is the civilians who are the victims here. We want to go where we think our children are safe."

Doctors at two of Mogadishu's main hospitals said 42 injured people were hospitalized overnight, seven of them were children. Five were treated early Tuesday.

"Some of the wounded are in a very serious condition with shrapnel wounds all around their body," said Dr. Dahir Mohamed, of the city's Medina Hospital.

Mogadishu's mayor blamed the attacks on remnants of the Islamic movement that was pushed out of Mogadishu and parts of the country's south earlier this year. The Islamic group has been accused of harboring Al Qaeda suspects, which it denies.

"It is a bad thing to watch our people dying in front of us and this would damage the unity of Somalia," mayor Mohamud Hassan Ali said on local radio.

The Islamic movement, which still has support in Mogadishu, has vowed to wage an Iraq-style insurgency, and attacks in the capital have happened almost daily in the past month.

But other residents said the casualties were the result of Ethiopian artillery. Many residents say the Islamic group brought a semblance of order to this anarchic nation.

The sound of gunfire could be heard throughout the night.

"We spent the whole night under this concrete wall because I do not know where to run," said Ruqiyo Madobe Ahmed, a 34-year-old mother of four. Hodan Wali Nuure, a mother of a 6-year-old boy who was wounded by shrapnel from a nearby explosion, said it was the worst night of fighting she had seen in the capital.

On Monday, a Somali government anti-terror unit trained by Ethiopian troops went into operation to quell the growing unrest.

It is a government plan to fight terrorists and bring them to justice, Deputy Defense Minister Salad Ali Jelle told The Associated Press.

He refused to provide more details about the unit but another government official, who spoke on condition of anonymity because he was not authorized to speak to the media, said it numbered around 700 soldiers.

Insecurity in Somalia has been growing since the transitional government drove out the rival Islamic movement with Ethiopian military help late last year. Since the government's return to Mogadishu, insurgents have staged near-daily attacks.

On Sunday, a car exploded in the capital, killing all four occupants. No one has claimed responsibility but witnesses said the car was hit by a rocket-propelled grenade fired from another vehicle.

Jelle said the occupants of the car were homicide bombers.

Somalia has not had an effective national government since 1991, when warlords overthrew dictator Mohamed Siad Barre and then turned on one another, throwing the country into anarchy. The transitional government was formed in 2004 with U.N. help.

Get complete coverage in FOXNews.com's Africa Center.