Scores of Kenyan troops have gone on the rampage, beating and detaining residents of the eastern town of Garissa, after three soldiers were shot dead by unknown gunmen.
A reporter in Garissa, near the Somali border, has told the BBC that the soldiers ordered people to evacuate a mosque before assaulting them.
The three soldiers were part of the African Union mission in Somalia.
They were killed as they were fixing a puncture on their truck, the army says.
Defence forces spokesman Cyrus Oguna said the gunmen escaped into the crowds of local residents who had gathered after the shooting.
The reporter, who is not being named for his own safety, says Garissa's main market has been set on fire.
There have been several recent attacks on Kenyan security personnel in Garissa, which have been blamed on the Somali militant group al-Shabab.
Garissa and nearby parts of Kenya are mainly populated by ethnic Somalis.
Kenya sent troops across the border last year to fight al-Shabab but its forces have since been merged with the AU force in Somalia.
The unrest in Garissa comes as Kenyan police fired tear gas to end riots that broke out in the capital, Nairobi, after a grenade blast killed nine people.
Al-Shabab has not commented on the grenade attack on a minibus - again it has been blamed for similar attacks in the past.
Reuters news agency reports that angry mobs of rioters threw stones and broke into Somali-owned businesses in the Eastleigh district, known as "Little Mogadishu" because of its large Somali population.
Ethnic Somali gangs retaliated with machetes, it says.
The BBC's Duncan Munene in Nairobi says a strong contingent of police tried to prevent clashes between rival groups who are facing off against each other in the area.
"There is chaos. Several people have been injured but we are doing everything possible to contain the riots," Nairobi police chief Moses Nyakwama said, AFP news agency reports.
Shops in the area are closed and most residents are staying indoors, our reporter says.
Ethnic Somali Kenyans have resided in Eastleigh for many years but refugees and migrants fleeing the anarchy in Somalia have boosted the area's population over the past two decades.