The Social Order of the Underworld: How Prison Gangs Govern the American Penal System. By David Skarbek. Oxford University Press; 240 pages; $99 (hardcover), $27.95 (paperback) and £64. Buy from Amazon.com, Amazon.co.uk

IN 2009 Edward John Schaefer drunkenly swerved his motorbike over a pavement in the town of Marin, California. He hit a father and his daughter. The girl died. Schaefer was jailed for life. Some ten days after arriving at San Quentin State Prison, Frank Souza, another inmate, stabbed Schaefer to death with a “bone-crusher”, a seven-inch homemade metal spear.

The murder was not a random act of violence. Nor was it an example of the haphazard terrors of prison life. Mr Souza was a member of the Aryan Brotherhood, a prison gang. When asked why he did it, Mr Souza replied: “All I got to say, nine-year-old girl.” The killing was justice, determined and meted out by the gang. It was one demonstration of myriad ways in which gangs provide governance in prisons. In “The Social Order of the Underworld” David Skarbek, an American political economist at King’s College London, shows how gangs have spread through the prison system in the United States. He argues, convincingly, that gangs offer protection and governance in places where established institutions fail, and that it makes sense for prisoners to join them.

Gangs did not exist until the 1950s. Prisons were governed according to the “convict code”, unwritten rules followed by everyone. At its most basic, the code decreed that inmates should not help officials in matters of discipline, nor should they ever give them any kind of information. With a small prison population, this worked. Fearsome reputations and fear of gossip, ostracism and assault constrained much disruptive behaviour. There was no need for organised groups.

But as the prison population exploded, the code began to fail. It was no longer possible to sustain reputations amid such huge numbers. First-time offenders, ignorant of the code and its rules, became more common. Violent inmates made prisons more dangerous. Officials could not be relied on to protect prisoners: “Most of us have wives and kids or grandkids,” exclaims one. “Are you going to risk your life by stepping in front of a knife when you have one lousy piece of shit trying to kill another lousy piece of shit?”

Gangs emerged to provide protection. Mr Skarbek traces how they then developed into businesses, controlling prisons’ booming illicit markets, especially in drugs. Gangs can trade far more effectively than lone inmates. Prisoners listen when they threaten violence; members can ease trade from the outside after their release. Consumers, in this case buyers of drugs, benefit too. Gangs are long-term sellers, so they have an incentive not to drive customers away by abusing their power.

Even the segregation of gangs along racial lines is rational. As Mr Skarbek points out, for gangs to function well, all members must accept responsibility for the actions and obligations of the rest. Identifying other members is crucial to avoid outsiders freeriding or damaging the group’s reputation. Race (and tattoos) provide ways of doing so. In an all-male community where everyone wears the same clothes, race provides a lot of information fast. It is impossible to conceal or change; segregation prevents prisoners moving from group to group or taking advantage of different gangs.

Mr Skarbek’s analysis confounds the assumption that prisons are stuffed with violent, racist thugs who act irrationally. The very logic of gangs’ existence may be the key to constraining them. Reduce demand for their services, he argues, by locking up fewer people and making prisons safer, and their appeal would diminish.