Four Somali government soldiers were among 13 people killed in a series of attacks in the capital, Mogadishu, over the weekend, police say.
Their vehicle went over a land mine in the northern Huriwa district. The soldiers then opened fire, killing four people waiting for a bus, they say.
Another four civilians were killed in the main Bakara market, while a deputy district commissioner was shot dead.
The attacks are blamed on Islamists and clan gunmen opposed to the government.
Mogadishu police commissioner Ali Said Hassan has confirmed all these incidents and said police operations were aimed at restoring law and order in the city, particularly the market.
"Our objective is to create a peaceful environment for the traders," he told the BBC.
The troops ask you to open your casket and go outside and then they steal your property
The police, backed by Ethiopian forces, have been searching for weapons in Bakara market, which they say is a hideout for insurgents.
Deputy Yaqshid district commissioner was shot dead by unknown men armed with pistols on Sunday.
"Three masked men armed with pistols shot Nuor Ilmi Farah several times in the head on his way to his house and scared away some people around before escaping with a mud-covered small car," said his neighbour, Mohamud Ahmed, who was having tea near where the shooting occurred.
His relatives rushed him to Medina hospital for treatment but he died on the way.
A hand grenade was thrown at a police patrol in Bakara market – the latest in a series of attacks on the main market in the capital.
Witnesses say they then opened fire, killing four passers-by.
The chairman of the traders at the market Ali Dheere has accused government forces of robbing them during the operations and warned that the traders would leave if the problems continue.
"The troops ask you to open your casket and go outside and then they steal your property – that is a barbaric act," he said.
Mogadishu mayor Mohamed Dheere said the issue was under investigation and apologised for any wrongdoing committed by irresponsible figures within the security forces.
"We are investigating and anyone found guilty of robbing will face justice," he said.
The Ethiopian-backed government forces are trying to bring security to Mogadishu, after ousting Islamists last December.