Relatives wait for news after a deadly riot at Desembargador Raimundo Vidal Pessoa Public Jail on Jan. 8 in Manaus, Brazil. (Raphael Alves/Agence France-Presse via Getty Images)

Since New Year’s Day, a wave of horrific prison massacres in Brazil’s north and northeast have left more than 110 inmates dead, many decapitated and disemboweled, with no end in sight. This is prison-gang warfare, pitting the São Paulo-based Primeiro Comando da Capital (PCC), now one of the largest criminal organizations in South America, against a local affiliate of Rio de Janeiro’s Comando Vermelho (CV). The gangs’ 23-year alliance ended in September 2016 when the PCC declared war, citing CV betrayals. A few weeks later, PCC-led prison riots in three states killed about 20 people, foreshadowing January’s bloodletting.

Brazil’s prison gangs wield immense power on the streets, and driving the violence is a dynamic of competitive expansion. After dominating and transforming the criminal underworlds of their respective home states in the 1990s, the PCC and the CV are now colonizing prisons, urban peripheries and trafficking corridors throughout the country. The scramble for Brazil’s criminal markets is on.

With so much at stake, recent prison killings may prove only the opening skirmishes of a prolonged, devastating conflict. Brazilian prison gangs’ capacity to orchestrate terrorist attacks could transform the country’s cities and borders into war zones, while their dominance of the penitentiary system means that state crackdowns and prison expansions may only make them stronger.

How did these gangs get started?

The CV emerged in the 1970s from the dungeons of Brazil’s military dictatorship, fruit of a misguided policy that jailed leftist militants together with common criminals. The CV’s founders gleaned organizational techniques from the militants and forged a new kind of prison gang that delivered social order and welfare to prisoners along with collective resistance against abusive officials. By the 1980s, the CV dominated not only Rio’s prisons but most of its favelas (slums) and the retail drug trade that operates out of them.

São Paulo’s gangs, 250 miles away, remained fragmented until 1993, when survivors of Carandiru — Brazil’s most lethal prison massacre, in which police killed 111 unarmed prisoners — banded together for mutual protection. The nascent PCC modeled itself on and declared an alliance with the CV, but quickly surpassed its older brother in size and sophistication.

As São Paulo’s governors cracked down on street crime in the late 1990s and 2000s, incarceration rates spiked, swelling the PCC’s ranks. Officials denied the gang’s existence until 2001, when the PCC launched a “mega-rebellion” with synchronized riots in 29 prisons. In 2006 it went further, orchestrating riots in nearly 100 prisons and a simultaneous wave of citywide bus-burnings and bombings that brought São Paulo to a standstill for days. State officials met with PCC leaders, agreeing to remove them from solitary confinement, and the attacks abruptly stopped.

Since then, the PCC has been actively expanding, with local chapters or allies in all of Brazil’s 27 states. The CV has been playing catch-up, often allying with local gangs to gain footholds in far-flung states. Still, until recently, the CV-PCC alliance held firm; in some places they even imposed local truces that significantly reduced homicide rates.

So are these prison gangs, street gangs, drug cartels or terrorist organizations?

All of the above. The CV and the PCC were both born in prison, both came to control street crime, and both have orchestrated terrorist attacks such as those in São Paulo in 2006. The CV monopolized Rio’s retail drug markets through armed occupation of the favelas; CV capos became de facto local rulers, enforcing a rough-hewn social order and often providing handouts to poorer residents. The PCC took a less territorial approach to drugs, focusing on wholesale distribution. Paradoxically, it also imposed a “criminal code of conduct” throughout the São Paulo periphery that prohibits unauthorized killings, contributing to a staggering drop in São Paulo’s homicide rate.

How do prison gangs control crime on the outside?

Street criminals can have many reasons to obey prison-gang rules. The most important is probably the one a Rio trafficker gave me: “Whatever you do on the outside, you have to answer for on the inside.” Moreover, the likelier you are to go to prison, the stronger your incentives to stay friendly with the gang that runs the place. This means that higher incarceration rates and anti-gang crackdowns can actually increase prison gangs’ influence over street-level actors (as I argue in this Monkey Cage post and a forthcoming paper).

This influence, David Skarbek shows, allows prison gangs in Southern California to govern otherwise unruly and violent urban drug markets, increasing overall profits and taxing the surplus. Indeed, from Los Angeles to Rio, prison gangs’ projection of power has transformed retail drug markets. These are usually fragmented, because it is difficult for one organization to control much turf. Mass incarceration solves this elegantly, arresting street criminals and physically confining them where prison gangs can easily reward obedience and punish defection.

The Brazilian cases prove that criminal governance can extend to whole peripheral communities. The PCC’s regulation of lethal violence and provision of dispute-resolution services, ethnographers find, constitute rules that many residents seem willing to submit to.

How do prison gangs spread?

The CV originally spread when officials unwisely dispersed its leaders among Rio’s prisons. PCC leaders have also been transferred to or arrested in other states, where they invariably founded local chapters. Conversely, some local copycat prison gangs were founded by inmates who spent time in PCC-controlled prisons in São Paulo.

Once sophisticated gangs emerge within a state’s prison system, they generally begin to organize drug turf in that state’s urban areas. This suggests that the PCC’s and the CV’s organizational know-how constitutes a replicable technology, one that gives them a game-changing advantage over local incumbent gangs.

This superiority helps explain the PCC’s rapid expansion across Brazil. Its colonizing mission is captured in a tenet recently added to its statute: “The Command does not have territorial limits. All baptized members of the PCC, regardless of their city, state, or country, everyone must follow our rules, hierarchy, and statute.”

What happens next?

The situation is bleak. With PCC and CV cells now present in virtually every state, nationwide prison massacres could be imminent. Even worse, the relative peace that gang consolidation brought to many of Brazil’s urban peripheries could easily flip into amplified proxy turf wars between these two criminal behemoths. Reports that the PCC now controls Rocinha, Rio’s largest favela drug market, raise the specter of an all-out PCC assault on the CV’s home city, possibly allying with local CV rivals in what surely would be a catastrophic battle for supremacy.

Officials have few good options, especially given Brazil’s current economic and political crises. But war is hell, prison-gang war included. The gangs may never be eliminated, but perhaps they can be coaxed into more peaceful forms of competition.

Benjamin Lessing is an assistant professor of political science at the University of Chicago. Follow him on Twitter @BigBigBLessing