Kenya’s police chief has ordered an investigation into claims that police flogged a group of young people in north-eastern Garissa county.
Photos posted on a policeman’s Facebook page appeared to show the whipping taking place.
The victims have been identified as Somalis who had crossed into Kenya.
Security forces in the area face a threat from the Somali Islamist group al-Shabab, which killed 148 people at Garissa University College in April.
In the pictures, about 10 young men are seen lying face down on the ground while they are being beaten by a man carrying a rubber hose and an assault rifle.
They have now been removed from Facebook, but the policeman’s commentary is still there.
“These Somali young men came to Garissa for a purpose but little did they know we [are] smarter than them,” he wrote.
“We shall not relent on security issues.”
In response to the pictures Kenya’s national police chief Joseph Boinett said this was not the way to “fight terrorism,” according to the Star newspaper.
Kenyan rights activists have also condemned the policemen for allegedly beating up the Somali youths.
“What will stop the victims from harbouring resentment against their government and having a soft heart for terrorists?” asked Khalif Abdi, coordinator of the North-Eastern Forum for Democracy.
But there were some sympathetic comments in response to the original post.
“If only we had a few individuals like you, God fearing security officers, we could be better placed,” one person wrote.
Somalis in Kenya have often complained of being unfairly targeted as the security forces try to deal with al-Shabab.