This story appears in the June 2016 issue of National Geographic magazine.

As night falls over San Antonio, a shantytown turned neighborhood with concrete-block houses, rugged streets, and few trees, children head excitedly to a warehouse stacked with tires. There the din of Ciudad Juárez recedes, replaced by grunts, slaps, and thuds—bam!—of supple young bodies slamming onto canvas.

The makeshift wrestling ring, fashioned from iron and cable scavenged from junkyards, belongs to Inés Montenegro, who opened it two years ago after one of his sons suggested the neighborhood’s children needed somewhere to play. In Mexico lucha libre, a style of pro wrestling with masked fighters performing scripted acrobatic moves, is a national obsession. Montenegro’s funky arena was an instant hit.

Tonight four boys ages 11 to 15—Omar, Alfonso, Eric, and Antonio—hurtle against the ropes, which slingshot them into the center of the ring. They bound gleefully, learning the choreography for such classic moves as the “tiger jump,” vaulting melodramatically into the ring, and the “scissors,” jumping from the ropes to wrap your legs around your opponent’s neck.

View Images On Easter Sunday the Ramos Gutiérrez children play in El Chamizal Park, one of the city’s few green spaces. The decades-old Juárez tradition of outings at the park on the holy day was too dangerous during the violent years.

The scene would have been unimaginable six years ago, when I last visited Juárez, the largest city in Chihuahua state. Child’s play had been banished from public spaces as drug cartels battled street by street to control the border city, a gateway to the lucrative U.S. drug market. I watched as Mexican soldiers in helmets and sunglasses rumbled in atop armored vehicles to reclaim those streets, gripping assault rifles and machine guns, one of many attempts to halt the macabre violence that had made Juárez infamous worldwide.

From 2008 to 2012, the city of 1.3 million people was widely deemed the most dangerous place on Earth. Murders shot above 3,700 in the worst year. Criminals kidnapped and extorted with impunity. A quarter of all cars stolen in Mexico were stolen in Juárez. Businesses closed by the thousands. Anarchy descended.

The San Antonio neighborhood was among the worst. The boys now cavorting in the wrestling ring each had relatives killed or jailed. Two of Antonio’s uncles were murdered. “We’d be out playing and hear gunshots, and we’d run for home,” he recalls.

Out in the colonias, or neighborhoods, at least 11 lucha libre rings now draw hundreds of kids donning personae such as Aztec Falcon and Ex-Convict. Juárez’s once empty streets are crowded again. Around the cathedral, clothing stores and Popsicle shops do a brisk business; cover bands play Spanish versions of “Johnny B. Goode” and “Jailhouse Rock” for shoppers who stop, listen, and dance. A children’s museum opened, aimed in part at the 14,000 who the museum’s director estimates were orphaned in the violence. Neighborhoods have organized sports leagues. Parks—including some new ones—are again places to socialize. “People are losing their fear,” Montenegro says.

View Images Natalia Carolyn Bencomo Neárez and her friends ride in a limousine on their way to her quinceañera party, an often lavish celebration common in Latin American cultures to mark a girl’s 15th birthday.

What happened in Juárez to allow Montenegro and others to stop cowering and resume living? This is no wrestling melodrama in which a masked hero triumphs. Mexico found the political will, in Juárez at least, to strengthen the criminal justice system and invest in the local government. Doing so encouraged bravery from some unexpected protagonists: law enforcement officials who forged a more professional police force in a country where cops are often corrupt, businesspeople who stayed to fight rather than flee, and government officials who challenged the sclerotic bureaucracy and spearheaded dramatic reforms.

In 1996, when I first went to Juárez, it was a whirring cog in the emerging global economy. Legions of rancheros and peasant farmers were arriving to assemble stereos, televisions, and car parts for the U.S. market in duty-free manufacturing plants called maquiladoras.

Many migrants arrived planning to cross the border into neighboring El Paso, Texas, but found that in Juárez’s expanding economy they could have what was denied them back home: a solid house, a used car, a steady job. Juárez filled with family businesses, including markets, beauty parlors, and upholstery shops.

Montenegro, who came to Juárez as a boy in the 1970s, was part of this entrepreneurial flowering. He bought land when San Antonio was just a shantytown. He started the tire shop that now houses his wrestling arena, then others, each to be run by a son.

Juárez grew chaotically. As with all Mexican cities, its tax revenue went to Mexico City. Not much came back. Police officers rationed gasoline and bullets. Basic infrastructure—roads, sewers, storm drains, parks—was neglected.

A Tale of Two Cartels Juárez suffered a dramatic spike in crime when the Sinaloa and Juárez cartels battled for dominance over lucrative drug-trafficking routes to the United States from 2008 to 2012. united states NEW MEXICO El Paso Ciudad Juárez Texas Gulf of Mexico Chihuahua Mexico Mexico City 3,766 homicides FRAGILE PEACE Homicide rates in Juárez have dropped as law enforcement has improved and violence has declined between the warring cartels. 3,000 2,000 1,000 256 45 1990 2000 ’10 ’15 Drug war NGM Staff. SOURCES: Justice in Mexico; mexican National Institute of Statistics and Geography A Tale of Two Cartels TEXAS United states NEW MEXICO Chihuahua united states Juárez suffered a dramatic spike in crime when the Sinaloa and Juárez cartels battled for dominance over lucrative drug-trafficking routes to the United States from 2008 to 2012. 10 Texas N. MEX. El Paso Ciudad Juárez mexico Gulf of Mexico Chihuahua EL CHAMIZAL PARK Mexico Mexico City 3,766 homicides TEXAS Chihuahua SAN ANTONIO FRAGILE PEACE WIDESPREAD VIOLENCE Homicide rates in Juárez have dropped as law enforcement has improved and violence has declined between the warring cartels. 3,000 In 2010, at the peak of the mayhem, about 10 people a day were killed across this city of 1.3 million. Ciudad Juárez SANTA MARÍA 2,000 El Paso city limit Prison ABRAHAM GONZÁLEZ INTERNATIONAL AIRPORT 2 mi 1,000 2 km 256 2 45 1990 2000 ’10 ’15 Each dot represents one homicide victim in 2010* Border crossing FRACCIONAMIENTO PRADERAS DEL SOL Drug war NGM STAFF SOURCES: Justice in Mexico; mexican National Institute of Statistics and Geography; Luis Ernesto Cervera Gómez, Colegio de Chihuahua; Municipal Planning and Research Institute, Ciudad Juárez; Attorney General of Mexico (Map data) *Dots are randomized within neighborhood boundARIEs and do not represent specific locations.

“People didn’t perceive we had any needs, because we kept growing,” says Alfonso Murguía, a pastor whose church has funded centers for orphans and drug addicts in Juárez for almost 30 years. “There was money and jobs, but the city wasn’t necessarily improving.”

As rural people became an industrial workforce, family ties withered. Thousands of kids grew up in the streets. Gangs multiplied into the hundreds. The Juárez cartel formed to control the main drug-smuggling routes. Lawlessness became commonplace.

I had come to Juárez two decades ago to write about the first of what would become hundreds of murdered young women—“the dead women of Juárez,” as they became known around the world. Through the dark years I returned a dozen times. Most factory workers were women who arrived without family, making them especially vulnerable. Many bodies were dumped in the desert, where the heat mummified them into anonymity. With killers facing no consequences, the deaths multiplied.

In 2008 Juárez lost 90,000 jobs as the U.S. plunged into recession, marooning a flotilla of desperate unemployed. About the same time the Sinaloa cartel moved in to try to wrest control of the drug routes from the Juárez cartel. Both groups began deploying the city’s street gangs in a vicious battle. For five years violence engulfed the city.

When Montenegro, a pleasant yet wary and taciturn man, tells me the story of Arena San Antonio, he starts by counting the families on his street who had loved ones kidnapped. “There were five,” he says finally, “including us.”

Kidnappers snatched his youngest son. Montenegro had to borrow money for the ransom. When he’d almost finished paying back the loan, his son was kidnapped again. For seven years Montenegro struggled to repay his debts, roughly $50,000. He sold some tire shops and was left almost broke. After a blood vessel in his eye burst from stress, he became partially blind. “I don’t wish kidnapping on anyone,” he says.

View Images At Arena San Antonio, a young wrestler perches on the ropes of the homemade ring. Inés Montenegro built the facility in his tire warehouse to give children a place to learn lucha libre, a wrestling style with masked fighters popular in Mexico. Children flock to the arena, one of at least 11 now in the city, walking on streets that were once dangerous.

When I return to Juárez, I hire a taxi driver named Jesús Amable to drive through a half dozen neighborhoods. That we could even take such a trip is proof of Juárez’s new peace. Still, many stores stand gapingly empty, their owners having fled.

At a bustling flower shop Claudia Saucido tells me she ran it alone while her husband worked elsewhere to help pay the hundred-dollar cuota—about a week’s pay in Juárez—levied by extortionists. Across the street Alfredo Rodríguez says his family couldn’t afford such bribes and closed the market his father started, only recently reopening it. Amable tells me he used to pay $20 a week, and so did nine colleagues at his taxi stand. “Fifteen-year-old kids would come, in brand-new cars, to collect,” he says.

By 2010 Juárez authorities estimated that some 8,000 businesses were being extorted. The next year, Carlos Salas, the newly appointed state attorney general, ordered the Chihuahua state police to create an anti-extortion squad.

Many crimes had gone unpunished. “There was no professional investigation; no bad investigation either. There just wasn’t any investigation,” says César Muñoz, a short, dapper man who was the squad’s first supervisor and is now chief of the Juárez city police. “When crimes happened, police would hide in our offices.”

The handpicked squad of young, untainted officers spent its first two weeks going door-to-door in downtown Juárez, urging business owners to report extortionists. This kind of community policing was unheard of in Mexico. “No one wanted to talk. Many of them thought we were extortionists ourselves,” says Luis Hernández, who now commands the squad.

The phone rang for the first time in the squad’s office two weeks later. It was a baker. Extortionists wanted $5,000, or they’d burn down his business. Then the squad listened in on his phone calls. The officers tailed the baker to the drop. When he handed over the money, they pounced. The arrest was the first successfully investigated extortion in Juárez during the violence. The extortionists—a housewife, a factory worker, and two tire-shop employees—were convicted.

“Soon we had too many businesses reporting the crime,” Hernández says.

A few months later the squad shot it out with a crew of extortionists, capturing three of them. That was new too. Until then, Juárez cops had bolted when criminals started shooting.

In October 2011 three officers were staking out a mom-and-pop grocery when gunmen ambushed and killed them. That night, the attorney general for the Juárez region visited the wakes. Miguel Ángel Saucedo, whose 23-year-old son was among the officers killed, urged him to continue the fight. “If you stop,” he said, “the effort he made will be worth nothing.”

“He wanted a better society,” Saucedo says, as we sit in the family’s modest living room. “When they formed that squad, things were very scary. Even so, he joined up.”

Diego’s Rebirth Former gang member Diego Montejano paints a mural to inspire local kids. “When we all change,” he says, “we can change the environment.” Montejano tells his story of redemption. (This video was supported by a grant from the Pulitzer Center on Crisis Reporting.)

The tragedy proved a turning point. The squad was expanded and targeted José “El Junior” Gómez Castañeda, the mastermind of an extortion racket raking in $400,000 a week. Ten suspects were rolled up, but not El Junior, who would call Muñoz to taunt him. The squad finally caught up with El Junior in 2013, storming a house with a pool, a gym, a video-game playroom, and a stripper’s pole. El Junior went to prison for life and hanged himself in his cell.

As the state police were launching their anti-extortion squad in 2011, the Juárez police department turned to a retired army lieutenant colonel who had modernized the Baja California state police and, as Tijuana’s police chief, helped squelch its throbbing violence in a year.

Julián Leyzaola, who retired from the police force in 2013, is a thin, unassuming fellow, easy with a smile. He is well-known in Mexico—notorious to some, heroic to others. His methods were hard-line, with what many activists insist was little appreciation for human rights. “There were confrontations, chases,” he says unapologetically. “Suspects would come out of them beaten up. That’s what happens.”

In Juárez, he says, he found a department with hundreds of aviadores, or “aviators,” government workers who show up just for their paychecks. “We had only about 300 officers out of 2,500 who were really working,” Leyzaola says. He fired the aviadores and let the others know that they had to patrol the streets.

Leyzaola bought new patrol cars to bolster the department’s fleet of 80 barely functioning vehicles, armed officers with Beretta and Glock handguns, and switched uniforms from “rat gray” to dark blue. “We fed that pride in wearing a uniform,” he says.

The police began to take the city back, military style, from the cartels, gangs, and others who had turned to crime. “We pushed them out,” he says, “little by little, always giving them an exit so as not to corner them.”

View Images Young skaters hang out at a new park in Díaz Ordaz colonia, a particularly poor area of the city, near where the territories of several street gangs once intersected. Children can also play basketball and soccer at this park; it’s part of the city’s effort to reduce violence by reaching out to gangs.

David Alamillo, a Juárez restaurateur and bar owner, was living in Europe in 2008 when his managers began to call, telling him about robberies, murders, and terrified employees. He decided he had to return, but he would go only for six months, he told his wife.

Alamillo is a bull of a guy, heavyset and loquacious—fitting for an impresario in the city’s rough-and-tumble nightlife. Within a week of his return, a man accompanied by six gunmen visited him, demanding $35,000. Alamillo didn’t pay; a week later one of his discos was torched.

As time went on, the extortionists became more suave. “Without curse words—like a good salesman,” Alamillo says. “They were smart. You begin to think maybe it’s not so bad to pay. Many people began not to pay taxes and instead paid the extortion. There was a turn, a culture of payment to organized crime. The other payments—for electricity, water—you stopped making those payments.”

Soon Alamillo was paying $2,000 a week. A man in a baseball cap came by every week, helping himself to booze and the payoff envelope.

Outraged by what was going on, Alamillo joined other influential community leaders in 2010 to form the Mesa de Seguridad, a public safety committee, to coordinate with police. The risk was so extreme that they met in secret, often at the airport in El Paso.

The well-connected leaders had the heft to push politicians to act. At their urging, Chihuahua’s legislators made kidnapping, extortion, and the murder of police officers, journalists, and three or more people punishable by life in prison. The maximum sentence had been 50 years.

For Mexico the committee was novel. For decades the paternalistic federal government discouraged such civic participation. And Mexico’s wealthy don’t have much social contact with police officers, who are often from the poorest families. “The narcos came from that class and understood the rejection the police felt,” Alamillo says. “The bad guys would invite them to parties, would offer them social recognition that society wouldn’t.”

So while the committee pushed for higher salaries, more training, and new equipment, it also promoted police appreciation. Using state and federal funds, the city opened a country club for officers and their families—with swimming pools, weights, bicycling, a picnic area, and a memorial to fallen officers.

At a meeting I attend, police administrators give accounts of their work while the businesspeople ask what crimes need more attention. The mood is cordial and familiar. For Mexico it feels like a revolutionary act when Jorge Contreras, a former chamber of commerce president, tells the officers, “We are very proud of the work you are doing.”

Sitting against the wall on the edge of his chair is a Juárez patrolman named Emilio Fernández, accompanied by his wife, two sons, and a daughter. Every month the committee honors a police officer. The committee’s coordinator, Alejandra de la Vega, asks Fernández to stand and praises him for hiking up hillside roads impassable to cars to hoist an old man with heart problems on his back and carry him down to paramedics.

“It was a heroic act, and we thank you and your family,” she says. Everyone stands and applauds. Fernández’s lip quivers. The eyes of his wife and daughter fill with tears.

The next day, Alamillo volunteers to show me around the city. We drive for miles past clusters of squat, white maquiladoras. We cross intersections where mini-markets and gas stations have staked out every corner. Alamillo turns into Fraccionamiento Praderas del Sol, a neighborhood where hundreds of tiny prefab box houses are vacant—a residue of the violence and the collapse of Mexico’s housing boom.

But Alamillo points out that most cars we see have license plates, unlike a few years ago. “You’d see three out of every 10 cars had no license,” he says. “An unlicensed car is the perfect vehicle for criminality. Correcting it was just about political will.”

By early afternoon we end up downtown again, at his new venture. Bathed in warm oranges, reds, yellows, and browns, Restaurante Viva México boasts street lamps, a walkway, singers, and a ring in the center for riders on horses to display lassoing tricks. Alamillo now has seven businesses, employing 300 people.

“We still have a long way to go,” he says. “We have to keep on.”

When I first visited Juárez, much of the criminal justice apparatus, including its jail and court system, was dysfunctional. The city had a tiny, grimy morgue and no forensic lab.

Alejandro Cárdenas came to the lab in 2002, when it was a small room at the local medical school with a corpse refrigerator that often broke down and stank horribly. He was asked to identify leathery corpses shrunken by the desert into gruesome unrecognizability.

Cárdenas is a quiet, stout man with graying hair and a trim mustache—a forensic dentist by training. Today he works in a modern building that was expanded twice in the violent years and now has a team of forensic anthropologists, a DNA lab, and a genetics lab.

View Images Employees of the criminal justice system and their families cool down at a country club only for them. The facility was built to demonstrate support for law enforcement as a way to combat corruption, improve morale, and encourage professionalism.

The morning I arrive, his assistants place a mummified older man in a rectangular tub. Cárdenas fills it with a chemical bath. Over three days the man’s nose, mouth, ears, and cheeks become more defined, until he is identifiable.

The rehydrating solution Cárdenas concocted is among the unheralded changes that helped pull the city from its nightmare. Like the business leaders and law enforcement officers who responded to Juárez’s violence, Cárdenas too had improvised.

He made his discovery by experimenting with animal tissues as well as dehydrated fingers, placing them in baby-food jars filled with different solutions. This went on for two years and a couple hundred fingers, to the skeptical amusement of his colleagues, until one day Cárdenas found a fully formed index finger.

Cárdenas shows me slides of many bodies he has rehydrated. From this chemical treatment emerged faces, tattoos, moles, scars, birthmarks, even tan lines. His invention has helped foil criminals who had relied on the desert to shroud their murders, as so many were doing in the years when hundreds of women were being killed. “Now if they do that,” he says, “we have ways of finding them.”

The transformation of Juárez’s criminal justice system can also be seen in its prison. Once virtually run by inmates, it was among the most dangerous lockdowns in Latin America. The state took it over in 2011. The most violent inmates were sent to federal prisons. Graffiti was scrubbed. Inmate-run stores and restaurants were closed. An altar to Santa Muerte, a folk saint favored by kidnappers, was removed. Equipment was installed on a tower to block cell phone calls. On a visit I found gleaming tile, bright lights, clean yards. By 2014 there were no killings, escapes, or riots. The prison, along with seven others in Chihuahua, is now accredited by the American Correctional Association.

As the violence was exploding, Mexico was instituting a U.S.-style trial system, with judges who hear testimony from sworn witnesses in courtrooms open to the public. For centuries Mexican judges had weighed written evidence and testimony, deciding guilt or innocence behind closed doors. Verdicts could take years.

Chihuahua was one of the first states to adopt the open-trial system, and Juárez was quick to implement it. The state built a spacious, airy courthouse complex. Things got worse at first. Prosecutors made rookie blunders. But by mid-2011, they were winning life sentences for extortionists and kidnappers.

In one courtroom I visit, a three-judge panel, after a month of testimony open to the public, convicts three men on trial for invading homes at gunpoint, robbing families, raping women, then making off with computers and televisions. Police had arrested the men, investigated the case, and found witnesses to testify.

“These guys were doing what so many young guys started doing,” Josefina Soara, the prosecutor, tells me as afternoon shadows spread across the complex. “They were getting a gun, going and robbing anyone that occurred to them. They figured that since the wave of violence was so huge, no one was going to pay any attention.”

View Images Fans cheer wildly throughout the inaugural game of the city’s new soccer team, F. C. Juárez, also known as Los Bravos. The team won, one to zero, and went on to win the 2015 league championship. Juárez’s previous team went bankrupt in 2011, but many fans still sport the old jerseys.

In Juárez homicides have fallen, from 3,766 in 2010 to 256 in 2015. Juárez is no longer on the list of the 50 most violent cities in the world. No cases of kidnapping or extortion have been reported in more than two years. Helped by the U.S. economic recovery, Juárez added 17,000 new jobs in the first half of last year, the best such figure in five years.

Alamillo insists that Juárez can be a model for other regions of Mexico still beleaguered by eruptions of medieval violence. “If Juárez can do it, why can’t they? It’s the same country,” he says. “We can change this.”

I’d like to believe him. Yet Juárez is in the north, a region closer to the U.S. market and typically more open to new ideas than the rest of Mexico.

Much of what weakened Juárez remains: low-paying, dead-end jobs; street gangs and drug cartels; more billboards than trees; and proximity to a neighbor with an insatiable appetite for drugs and few controls on guns.

What’s more, politicians haven’t touched the political system’s corruption and lack of accountability, which allowed small-time drug traffickers to become national security threats. Though almost half of Chihuahua’s tax revenue is generated in Juárez, only a small percentage of that money returns to the city. Juárez remains a city of too many potholes and too few parks.

Still, the transformation seems credible, though some say it is also the result of an accord between the Sinaloa and Juárez drug cartels. “It’s possible. I don’t know,” de la Vega says. “What I do know is that police are doing a much better job. There are murderers in prison, kidnappers in prison, extortionists in prison.”

The answer was always in Juárez, Leyzaola tells me when we meet for breakfast.

“People think someone’s going to come from outside and cure the problem,” he says. “People think a messiah will come. No. The key to success is to strengthen what’s local.”

Two months after our conversation Leyzaola was shot multiple times while parked on a Juárez street, a reminder of how dangerous the city remains. He is now paralyzed and uses a wheelchair but has moved back to Tijuana and is running for mayor. As evidence of how much has changed in the city he left behind, the police quickly caught and charged two alleged attackers. Their trials will be open to the public and reported by the media. And if convicted, they’ll spend years in prisons run by guards, not inmates.