HOUSTON, Texas — Beto O’Rourke lost Texas in 2018. But his unsuccessful Senate bid led to a big change in the state’s largest city: a major overhaul of the criminal-justice system.

Published in partnership with the BBC . You can listen to the BBC World Service's audio documentary here

The candidacy of O’Rourke, a young and charismatic congressman, energized Democratic voters in this red state and added momentum to a slowly-building blue wave in Harris County.

The victorious Houston-area Democrats—including 59 judges and the county’s top executive—have tackled the hot-button issue of bail reform and are debating how to improve the system for making sure poor people are represented by lawyers in criminal court. Some new judges have changed longstanding courtroom culture, ending the shackling of juveniles and fining prosecutors for withholding evidence.

Conservatives, law enforcement officials and the bail bonds industry have attacked those changes, but have not been able to reverse them.

The shift in Harris County is part of a broader rethinking of criminal justice across the U.S. As long-time advocates against mass incarceration are joined by celebrities like Kim Kardashian, “progressive prosecutors” gain steam, executions decline and both states and the federal government continue rolling back harsh drug policies.

“For a very long time Texas was the death penalty capital,” said Rodney Ellis, a longtime Democratic politician who’s now a commissioner on the five-person board that runs the county. “Harris County was the epicenter of it, and there were legendary press stories about sleeping lawyers representing people on death row.”

Since the U.S. brought back capital punishment in the 1970s, the county has sent 129 men and women to the death chamber, more than any entire state except the rest of Texas. Fifteen years ago, nearly a quarter of new prisoners in the state system came from Harris County. The number has since fallen by half and now accounts for only one eighth of prison admissions.

At the same time, the state and county demographics have shifted. Texas is now one of few majority-minority states in the nation, and in both the Houston area and the state as a whole, growth in the Latino population—which tends to vote more Democratic—has outpaced the growth in the white population.

Amid those changes but “before Beto,” Kim Ogg won her 2016 bid to be Harris County’s top prosecutor. She made some progressive moves, limiting marijuana arrests and sending fewer people to prison. But the local courts were still largely controlled by Republicans, many of whom opposed cutting back cash bail requirements.

That turned into a major issue in the 2018 race, as the county grappled with a class-action lawsuit originally filed on behalf of a young mother who’d been held in jail for driving without a license and could not afford $2,500 bail. The lawsuit argued that the county’s reliance on cash bail was unconstitutional because it amounted to a “wealth-based detention scheme,” where rich people could pay for their release while poor people would have to stay in jail. The county, and the 16 misdemeanor judges named as defendants, fought the lawsuit in federal court.

Then in 2018, Beto happened—and his momentum carried down the ballot. As a result, Democrats won control of the county government and swept the judiciary, bringing in socialists, former defense lawyers, and 17 African-American women who campaigned under the slogan “Harris County Black Girl Magic.”

“We expected to be the leaders of this situation,” said Judge Shannon Baldwin, who now oversees one of the misdemeanor courts. “We expected to be the model now for what criminal justice reform looks like.”

Last year, the county and the new misdemeanor judges agreed to a settlement that largely eliminates cash bail for low-level arrests.

“When I ran for office, I was really running to become a defendant in the lawsuit,” said Judge Franklin Bynum, a self-described socialist who oversees a misdemeanor court. “Rather than fighting the lawsuit and spending all this money and hiring all these experts to say there’s no problem, suddenly we all admit there’s a problem.”

Now roughly 85 percent of misdemeanor arrestees are automatically released without paying, and the county is beginning to grapple with another bail lawsuit focused on felony cases. Under the new judges in the county’s juvenile courts, the number of Houston-area children sent to juvenile prisons has fallen drastically, from 149 in 2018 to 62 in 2019.

At the same time, there’s been a sharp rise in the number of criminal cases tossed out of court, as magistrates and judges scrutinizing new cases are more frequently determining there’s not enough “probable cause” to move forward. In 2019, more than 3,200 cases were dismissed due to a lack of probable cause, a more than 70 percent increase from four years earlier, according to the district attorney’s office.

Some of the changes—including to local bail practices—have already sparked criticism from the police union, whose outspoken leader has sparred with the new judges and district attorney in the past. “There were parts of bail reform that were essential to have,” said Joe Gamaldi, the Houston police union president. “But they’re so enamored with, ‘Hey, we can do this!’ that they don’t stop to think if they should.”

Will the changes in Houston’s criminal justice system stick? Could they snowball? Answers could come later this year when the district attorney is up for reelection. She currently faces challengers from the right who want to roll things back—and from the left, pushing for more.