At least nine civilians were killed and 20 were wounded overnight when Islamist militants and Somali government forces exchanged mortar fire in Mogadishu.

The mortar fire started after the rebels attacked government positions in the southern part of the capital, they said.

"Five people were killed in a restaurant in the Bakara market area and seven were wounded," a witness, Ali Mohamed Hassan, said.

Four other civilians were killed by mortars in other parts of the city.

"Two people were killed in a house right next to mine in Hararyale district. Everyone is traumatised by the bombs because they're hitting heavily populated parts of town," Mogadishu resident Ibrahim Moalim said.

In all, according to the city's ambulance services, 22 wounded people were taken to the town's various hospitals and two of them died on the way.

Somalia has been in chaos since 1991. Hizb al-Islam and the hardline Shebab armed group are the two main factions in the insurgency bent on toppling President Sharif Sheikh Ahmed and ousting African Union peacekeepers from the country.