Editor's Note: One out of three Africans paid a bribe in the past year to obtain a government document, get medical care, place kids in school or settle an issue with police, according to a recent survey. Police consistently attracted the highest ratings of corruption, including those in Kenya. NPR's Gregory Warner looks at the impact it has on the country.

Kenyan security forces have long been rated among the most corrupt institutions in the country. But even jaded Kenyans expressed shock when closed-circuit footage seemed to show Kenyan soldiers looting stores of cellphones and cash during a terror attack on an upscale Nairobi mall in September.

Even more horrifying was that this alleged looting was captured on the second day of the four-day siege, while the terrorists were apparently still alive in the building and hunting down more victims.

An Ex-Cop's Story

Since the terrorist attack and its aftermath, I've spoken with many current and former security officers in Kenya about how the forces became so demoralized. Many of these stories are personal, but they add up to a consistent picture: poor pay, corrupt bosses and pervasive nepotism.

James Kusimba tells me a story about the day he hit the glass ceiling. It was June 1996. He'd been in the elite Kenyan special forces — the GSU — for six years. He'd served in the even more elite presidential guard. But he was still making the equivalent of $87 a month as a low-ranking officer. So he applied for a course to become a sergeant and earn more money.

Although he was refused admission into the course, he was considered smart enough to be chosen to teach the same course the following term. That is, he was asked to instruct the very material he was deemed unfit to learn. The same thing happened the following year, and the next and the next. It was then he realized that he was stagnating.

"It was very difficult for people coming from some regions to get a breakthrough and get promoted to senior ranks," Kusimba says.

Not only was he the wrong tribe, but he also lacked the necessary connections to get promoted.

"I didn't have a godfather to push my case," he says.

Kusimba turned in his badge in 2004. He's now a security officer for DHL, the shipping company, where his salary is three times that of a police sergeant, the rank he never attained.

You'd think he'd be happier about that huge pay raise. But the pride he feels in providing for his family is tinged with resignation. He feels like he missed his true calling as a cop.

Feeling Like A 'Drunkard's Rooster'

For years there has been talk about the culture of corruption in many African countries that often allows bad behavior to go unpunished. But talking to Kusimba and other former police, you hear the flip side of that story: When good behavior goes unrewarded, many ambitious would-be civil servants are driven to quit in frustration.

"Poor pay, nepotism, promotions do not come on merit — all that kind of rot makes people get frustrated and leave the force," says George Musamali, another former policeman who now runs his own security company.

There's a local expression for this sense of frustration and uncertainty: Police say they feel like they are the "drunkard's cockerel" (a "drunkard's rooster," Americans would say).

Because though the rooster or cockerel is the most valuable chicken in the coop, when the drunkard who controls those chickens comes home sloshed and starving, anyone's neck could end up on the block — even the rooster's.

"People in the service are feeling like a drunkard's cockerel — quite unsure of themselves," Musamali says. "They don't know what will happen tomorrow: Will I be in service or will I be kicked out? And it is not because I am incompetent. [It's] because somebody somewhere for political reasons feels uncomfortable working with me."

When you can't plan for tomorrow, he says, you grab whatever you can today. This shortsightedness, he says, has been corroding Kenya's security forces for years. It was exposed to the world when footage from Westgate Mall showed uniformed Kenyan soldiers apparently looting stores.

Kenya's top officials have now vowed to root out corruption. They've even promised a pay raise. But current and former security officials say real reform means putting aside entrenched tribal politics and reversing a longstanding brain drain.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.