Philadelphia just became one of the few cities to take among the surest steps possible to unravel mass incarceration.

On Tuesday, a very progressive candidate, Larry Krasner, won the Democratic primary election in the district attorney’s race. In a city that’s heavily Democratic, the victory all but guarantees the criminal defense attorney will be the next prosecutor for the city, which is the fifth most populous in the US.

The other candidates in the race ran on relatively progressive platforms, but Krasner had the strongest progressive record on criminal justice issues. He has sued law enforcement and government agencies more than 75 times, and he’s worked for Black Lives Matter, Occupy Philly, and protesters at the 2000 Republican National Convention in Philadelphia.

As Holly Otterbein wrote in Philadelphia magazine, the election is a surprising turn of events for a city that’s known for some of the toughest criminal justice policies in the nation, and whose district attorney’s office has been mired by scandal — the current prosecutor, Seth Williams, is leaving office under a corruption investigation. Otterbein wrote:

It is a stunning victory in a city that elected Lynne Abraham — once dubbed the “deadliest DA” in America by the New York Times — four times in a row. Krasner campaigned on the most progressive agenda of all the candidates, promising to end “mass incarceration” by effectively starving the criminal justice system. He vowed never to ask for cash bail for nonviolent offenders, pursue the death penalty, or bring cases based on illegal searches. He also said he would expand the city’s drug courts and diversion programs for low-level offenders.

It’s exactly these types of elections that will decide the future of incarceration. While much media attention has gone to the federal system and attempts to reform it, the great majority of incarceration occurs at the local and state level: The latest data by the US Bureau of Justice Statistics shows that about 87 percent of US inmates are held in state prisons.

Prosecutors are very powerful in these systems. They effectively decide who goes to prison and who doesn’t, and how long someone will go to prison for — by unilaterally choosing what charges to bring against anyone.

Yet even as the movement for criminal justice reform has built up around the nation, prosecutors have largely avoided the spotlight as some of the main drivers of mass incarceration. Krasner’s election, along with some other elections we’ve seen in the past year, show that may be changing.

Prosecutors are now the key drivers of mass incarceration

Typically, discussions of the criminal justice system focus on lawmakers, prisons, the police, and maybe judges. Rarely, however, is the most powerful actor in this system mentioned: the prosecutor.

Prosecutors are enormously powerful in the US criminal justice system, in large part because they are given so much discretion to do whatever they want. For example, in 2014 Brooklyn District Attorney Kenneth Thompson announced that he will no longer enforce low-level marijuana arrests. Think about how this works: Pot is still very much illegal in New York, but the district attorney flat-out said that he will ignore an aspect of the law — and it's completely within his discretion to do so.

On the other side of the spectrum, prosecutors can decide what charges to bring against specific individuals. Should they bring the type of charge that will trigger a lengthy mandatory minimum? Should they bring a charge that’s only a misdemeanor? That’s mostly on the prosecutor to decide.

Courts and juries do, in theory, act as checks on prosecutors. But in practice, they don’t: More than 90 percent of criminal convictions are resolved through a plea agreement, so by and large prosecutors and defendants — not judges and juries — have almost all the say in a great majority of cases that result in incarceration or some other punishment.

John Pfaff, a criminal justice expert at Fordham University, has found evidence that prosecutors have in fact been the main drivers of mass incarceration over the past couple decades.

Analyzing data from state judiciaries, Pfaff compared the number of crimes, arrests, and prosecutions from 1994 to 2008. Pfaff found that reported violent and property crime fell and arrests for almost all crimes also fell. But one thing went up: Although the number of crimes and arrests dropped, the number of felony cases filed in court rose dramatically. Prosecutors were filing more charges even as crime and arrests dropped, throwing more people into the prison system. Prosecutors, in short, were driving mass incarceration.

“When I first saw my own results, I stared at my computer for a few minutes in disbelief,” Pfaff wrote in his recent book, Locked In: The True Causes of Mass Incarceration and How to Achieve Real Reform. “I had expected to find that changes at every level — arrests, prosecutions, admissions, even time served — had pushed up prison populations. Yet across a wide number and variety of states, the pattern was the same: the only thing that really grew over time was the rate at which prosecutors filed felony charges against arrestees.”

In fact, Pfaff uncovered evidence that prosecutors may continue to drive incarceration up even as lawmakers pass reform to scale back imprisonment rates. “Take South Dakota, which in 2013 passed a reform bill that aimed to reduce prison populations,” he wrote. “The law did lead to prison declines in 2014 and 2015, yet at the same time prosecutors responded by charging more people with generally low-level felonies, and over these two years total felony convictions rose by 25 percent.” In the long term, this could lead to even larger prison populations.

Now apply this story on a national scale. There is less crime compared to the 1990s. Police are making fewer arrests. Lawmakers are slowly reducing the length of prison sentences. Yet until 2010, incarceration rates had continued climbing up nationwide — and, as Pfaff points out, the recent drop in incarceration would be much less pronounced if it wasn’t for court-ordered drops in California’s prison population. Prosecutors have been abetting more and more incarceration while other actors in the system have been pulling back.

Reformers are now grappling with the role of prosecutors

Despite the role of prosecutors in driving up mass incarceration, reformers have for the most part ignored these actors over the past few years. Pfaff notes: “No major piece of state-level reform legislation has directly challenged prosecutorial power (although some reforms do in fact impede it), and other than a few, generally local exceptions, their power is rarely a topic in the national debate over criminal justice reform. They are essentially invisible.”

The Krasner election shows this may be finally turning around. Philadelphia Justice and Public Safety, financed by billionaire donor and criminal justice reformer George Soros, put more than $1 million into the race. Soros has also put money in other races, previously helping defeat a “tough on crime” prosecutor in the Chicago area and pouring money into races ranging from Mississippi to New Mexico.

The American Civil Liberties Union, with support by Soros, also played a big role in the Philadelphia campaign. As Ben Wofford reported for Politico, the national civil rights organization canvassed for people to get out to vote for the district attorney. While the ACLU never formally endorsed a candidate (due to its tax status), it was widely believed that Krasner was the group’s favorite in the race.

“If we’re ever going to genuinely transform our nation’s criminal justice system, then we have to overhaul prosecutorial practices,” Udi Ofer of the ACLU told Politico. “If there’s one person in the system that can end mass incarceration tomorrow if they wanted to, it’s prosecutors.”

In criminal justice, it’s local and state systems that matter

The Philadelphia election illuminates one potential bright spot as President Donald Trump resides in the White House: Although Trump ran on “tough on crime,” pro–mass incarceration policies, the reality is most incarceration is done at the local and state level — giving reformers an avenue to pursue reform even as Trump remains in office.

Consider the statistics: In the US, federal prisons house only about 13 percent of the overall prison population. That is, to be sure, a significant number in such a big system. But it’s relatively small in the grand scheme of things, as this chart from the Prison Policy Initiative shows:

One way to think about this is what would happen if Trump used his pardon powers to their maximum potential — meaning he pardoned every single person in federal prison right now. That would push down America’s overall incarcerated population from about 2.2 million to 2 million.

That would be a hefty reduction. But it also wouldn’t undo mass incarceration, as the US would still lead all but one country in incarceration: With an incarceration rate of about 629 per 100,000 people, only the tiny island country of Seychelles would come ahead.

Similarly, almost all police work is done at the local and state level. There are about 18,000 law enforcement agencies in America — only a dozen or so of which are federal agencies.

While the federal government can incentivize states to adopt specific criminal justice policies, studies show that previous efforts — such as the 1994 federal crime law — had little to no impact. By and large, it seems cities and states will only embrace federal incentives on criminal justice issues if they actually want to adopt the policies being encouraged.

Criminal justice reform, then, is going to fall almost wholly to cities and states. That’s why Krasner’s victory is such a big deal: In the age of Trump, it shows criminal justice reform still has a lot of room for victory where these kinds of wins can matter most.