Fighting between the military and police backed by intelligence forces killed nine people in the Somali capital on Saturday, police said.
"It seems they mistook the Somali national army for (clan) militias. The death toll is nine people including a civilian," Major Abdullahi Hussein, a police officer, told Reuters.
He said the fighting occurred because police were wrongly informed that there were armed militias in the area.
"Accidents happen," he said.
Somalia has been riven by civil war since 1991, when clan-based warlords overthrew a dictator then turned against each other.
The weak UN-backed government is now battling an extremist insurgency, but many members of its security forces are badly trained and coordination is poor.
"Last night security forces (the police and intelligence) besieged us and then opened fire. We defended ourselves and chased the so-called security forces after hours of fighting today. We lost two soldiers and a wife of my colleague," Major Nur Osman, a military officer, told Reuters on Saturday.
"The land belongs to the military, it houses the families of soldiers. However, the security forces were trying to force us off the land," he said.
Residents said the fighting was terrifying.
"We were awoken last night ... by gunfire ... We took our babies on our shoulders and fled," resident Mohamed Idle told Reuters.
In a separate incident on Saturday, extremist insurgents briefly entered the town of El Wak in Gedo region, southern Somalia, near the border with Kenya.
"A few soldiers were in El Wak and they left in the morning for tactical practice. Many al-Shabab fighters advanced," Captain Ibrahim Ali, a military officer, told Reuters.
Al-Shabab said they stayed briefly, took weapons and supplies, and left.
(Source: Reuters)