Nairobi — Undermanned, underfunded, underwhelming: African police forces struggle to contain regular crime, and they are even further out of their depth when it comes to tackling violent extremism.
The best way to identify threats to public safety is a policing model that promotes trust and collaboration with the community, say the policy manuals on preventing violent extremism, better known as PVE. A positive relationship is believed to help build resilience to radicalisation.
But the reality in much of the world is that the police are viewed as corrupt, violent, and people best avoided.
"In African culture the police are there to intimidate, to coerce," acknowledged Kenyan senior sergeant Francis Mwangi.
He is trying his best to change that perception. Sharp and articulate, Mwangi is the face of a new policing initiative in the Nairobi slum of Kamakunji, which aims to build a partnership with the community to help blunt radicalisation of the youth.
Traditional policing - far too often based on brutality and arbitrary arrest rather than proper detective work - can create more fear of the security services than the insurgents and is clearly counter-productive.
A new UNDP study based on interviews with more than 500 jihadists - drawn mainly from Kenya, Nigeria, and Somalia - found that in over 70 percent of cases "government action", including the killing or arrest of a family member or friend, was the tipping point that prompted them to join.
Why is the culture of human rights abuse and resistance to reform so deeply ingrained?
Part of the problem is history. African police forces were set up by the colonial powers to maintain control over the local population. Independence didn't really change that function. Their role largely remains regime protection and representation rather than serving the public.
As a result, most police forces are seriously undermanned. The UN recommends a ratio of 300 officers per 100,000 citizens. It's a rough guide - force levels are influenced by a range of factors. But Kenya manages a ratio of only 203, Nigeria 187, and Mali - another country facing an Islamist insurgency - just 38.
Police forces are also underequipped. From vehicles and the fuel to run them, to paper, pens, and printing ink. The barest of necessities are in short supply, before you get to functioning forensic labs and national fingerprint databases.
Unsurprisingly, conviction rates are low. In South Africa, one of the more advanced police forces on the continent, only an estimated 10 percent of murder cases end in conviction. In crimes of sexual violence, it falls to between four and eight percent.
The temptation, then, is to turn to forced confessions. In Nigeria, torture has become such an integral part of policing that many stations have an informal torture officer, according to a 2014 Amnesty International report.
The prevalence of shoot-to-kill policies are also a reflection of the failure of the criminal justice system, with sections of the community seeing themselves as targets of persecution.
Police hit squads take that logic one step further. In the Kenyan port city of Mombasa, they are known to operate against so-called radical elements, whose deaths only serve to stoke the anger of Muslim youth, who view themselves as already marginalised.
Nigeria provides a stark example of the impact of the failure of due process. In 2009 the police killed Boko Haram founder Mohamed Yusuf while he was in custody. It did not stop his movement, and his successor, Abubakar Shakau, has proved a far more brutal and implacable enemy.
The impunity of the police commanders involved in the murder undermines the moral authority of the Nigerian state.
Governance failure is key in the tolerance of abuse. A corrupt political system breeds corrupt cops. If states are unwilling to provide opportunities, services, and rights to entire sections of its citizens, "there is then little reason to expect national police actors to do so", argues a report by the Global Centre on Cooperative Security.
The subservience of the police to the ruling elite doesn't win them any political favours. Conditions of service are generally appalling and pay poor. Families of officers killed in action can struggle to receive their benefits - with kickbacks expected.
A former Nigerian Inspector General of Police acknowledged that some barracks were "to say the least, nauseating". In the absence of accommodation, one Nigerian officer told IRIN how he spent the first few months of his posting to the northeastern city of Maiduguri sleeping on two plastic hard-backed chairs.
The police top-brass regularly make whistle-stop visits to the city as part of political entourages, but hardly ever drop in on the officers who are on the frontline of the insurgency, and very much targets for Boko Haram.
Predatory police take out their frustrations on the public - typically the most vulnerable and powerless members of society. According to an Afrobarometer survey across 34 countries, the police are universally regarded as the most corrupt of institutions - well ahead of even government officials.
"In most cases the police in Africa are demoralised because the remuneration they are getting is just peanuts," said sergeant Mwangi in half-hearted mitigation. "They have a family to feed so can be prone to being compromised."
In the Afrobarometer survey, more than half of respondents who had been victims of a crime did not report it to the police. Regionally, levels of distrust were highest in East Africa - just 43 percent said they would seek the assistance of police first if they became victims.
That's because the police don't have a monopoly on criminal justice. People often have multiple choices, with varying degrees of legitimacy and links to the state - from family and friends out to exact revenge, to local militia, customary courts, and formal commercial security guards.
Western models of PVE stress community policing - the ideal of the "bobby on the beat". But in an African context, community policing means something quite different.
These informal security systems - some of which are just plain vigilantes - have less to do with notions of state legitimacy, "and more to do with what's available, trusted, and affordable," the Global Centre on Cooperative Security report points out.
Security sector reform is a growth industry in aid world, despite little concrete evidence of success. The reports compiled by external police experts, paid for with donor money, gather dust on the shelves of police commands, the officer in Maiduguri told IRIN.
According to researcher Alice Hills, police reform cannot be divorced from "fundamental socio-political change". Without buy-in from the powers that be, the effects are only transitory.
The lessons being learnt by sergeant Mwangi in Kamakunji, for instance, are yet to feature in the curriculum of the Kenyan police college.
Reform is admittedly difficult to tackle in the middle of an insurgency. The priority of governments and their international partners is for harder-hitting security services, not the soft power of PVE.
What that can mean in practice is squads of men who are simply more proficient at harming their fellow citizens and extracting rents.
What is needed are "programmes that recognise that the core problems of governance lies in incentives and desire, not capacity," write researchers Rachel Kleinfeld and Harry Bader.