This is how it used to work: In the 1970s farmers would pay Mexican officials for permission to plant hectares of marijuana or poppy. “Once the fields had been sown,” an anonymous source tells Mexican journalist Anabel Hernández, “they stuck little colored flags on them, according to the arrangement. This meant that when the [government] helicopters flew over, instead of fumigating them they would water them.”

Drug traffickers also paid fees to store their harvest in warehouses, and again to smuggle the drugs over the border into the United States. Through such under-the-table “taxes,” which amounted to about $60 a kilo, the Mexican government fattened its coffers while controlling the production and movement of drugs within its borders.

Today the servant has become the master. Cartels dominate not only large portions of Mexico’s government, but also much of the country’s civil society. Their payroll includes not just army personnel, police officers, intelligence agents, prison guards, business owners, and politicians, but also soda vendors, tortilla sellers, and gas-station attendants. Under their rule, fear has reached legendary proportions throughout Mexico. A man in Ciudad Juárez tells journalist Óscar Martínez that he’s afraid to use public bathrooms because he doesn’t want to find decapitated heads. “It sounds at first like he’s paranoid, or crazy,” Martínez writes, “but it’s happened to him twice.”

How did the Mexican government lose control of its traffickers? An answer can be found in two new books: Hernández’s Narcoland: The Mexican Drug Lords and Their Godfathers and Martínez’s The Beast: Riding the Rails and Dodging Narcos on the Migrant Trail. Together they provide a top-down, bottom-up view of how Mexican cartels have consolidated and corporatized in the past two decades. As the cartels have integrated vertically, destroyed their competition, and diversified their interests, their business has grown more efficient—and so has their cruelty. In fact, a short version of Hernández’ book might run like this: Government officials thought they were training sheep; instead they were raising wolves.

Mexican police tolerated drugs in the 1970s for two reasons: they considered leftists their real enemy, and they were broke. Local branches of the federal judicial police received no money for cars, radios, guns, or support staff. A periodic shearing of the local drug men funded operating budgets. Hernández’ primary source for this history is an anonymous “Informer” who, she says, observed the drug world from within the Mexican government for 35 years. He alleges that three branches of government each took a cut of the drug “tax.” Every month, he says, three suitcases traveled throughout Mexico, gathering bundles of cash on their way to the capital. There, one suitcase stopped at the attorney general’s office, another at the secretary of the interior, and a third at the secretary of defense. (Hernández reveals few details about this informer, a fundamental weakness of Narcoland, though understandable given how many witnesses have been assassinated in Mexico over the past decade.)

The so-called “years of control” unraveled in the 1980s. According to the informer, the change began when President Miguel de la Madrid took office in 1982 and appointed Sergio García Ramírez attorney general. Rather than tax all traffickers and spread the proceeds around various departments, García Ramírez’ staff protected pet traffickers in each region, then funneled their “taxes” into the pockets of individual politicians.

Bigger, richer traffickers meant more money for their political mentors. But selective protection also meant that the little criminal gangs began to consolidate into larger, more organized cartels. “Semi-illiterate peasants [turned major cartel leaders] like El Príncipe, Don Neto, El Azul, El Mayo, and El Chapo would not have got far without the collusion of businessmen, politicians, and policemen, and all of those who exercise everyday power from behind a false halo of legality,” Hernández writes. “All these are the true godfathers of Narcoland.”

In the 1980s, the fledgling cartels also located an unexpected source of support: the CIA. After 1982’s Boland Amendment made it illegal for the Reagan administration to continue funding the Nicaraguan Contras, the CIA used Colombian cocaine traffickers as a source of off-the-books cash. In exchange, CIA agents let tons of Colombian cocaine enter the US, sometimes on government planes. The upshot of this lesser-known piece of the Iran-Contra affair is that Mexican cartels began to play a crucial role in the distribution of cocaine. As Hernández points out, Mexico has “a strategic location, halfway between producers and consumers.” Airplanes leaving the US with medicine and weapons for the Contras, or flying back with Colombian drugs, would stop at hidden landing strips in Mexico to refuel.

Marcela Valdes is a freelance writer who specializes in Latin American literature and culture.