NAIROBI, Kenya — John Kioko Muthini, a high school student, was playing pool with his friends a little more than two weeks ago in a slum on this city’s fringe when two police officers walked in, looking for a thief. They ordered everyone to their knees, and then, numerous witnesses said, they shot Mr. Muthini in the head.

His friends said that his last words, as he begged for his life, were “It’s not me.”

Last weekend, in a remote valley in northern Kenya, several dozen rookie police officers were sent to chase down an especially tough gang of cattle rustlers. It was dark, about 4 a.m., and the rustlers knew the officers were coming. As soon as the officers marched in, single file, they were mowed down by automatic weapons. Police officials said that at least 30 officers, maybe more, were killed, with their bodies left to fester in the sun for several days.

The two episodes were hundreds of miles apart and technically had nothing to do with each other. But beneath them was the same rotten root: a spectacularly dysfunctional national police force.

“On a scale of 1 to 10, I would give our police a 2,” said Macharia Njeru, the chairman of Kenya’s new police oversight board, citing corruption allegations, human rights abuses, extrajudicial killings, failed inquiries and lost public trust.