Tiffany Cabán, the 31-year-old public defender endorsed by Alexandria Ocasio-Cortez, is on the verge of a stunning upset in a Queens district-attorney’s race that could dramatically impact the direction of criminal-justice reform in America.

With 98 percent of the vote reported, Cabán held a razor-thin 1,229-vote lead over Melinda Katz, the borough president backed by the same Queens Democratic machine that Ocasio-Cortez crushed one year ago. Katz has refused to concede, waiting for absentee votes to be counted.

Cabán’s startling performance may not only redefine criminal-justice reform but also New York’s once-ossified, hierarchical political scene. Bold leftists are ascendant, with groups like the Democratic Socialists of America evolving from a curiosity to a preeminent vote-getting force in the city.

“When we started this thing, they said I was too young. They said I didn’t look like a district attorney,” Cabán said Tuesday at her raucous election-night party. “They said we could not build a movement from the grassroots. They said we could not win. But we did it, y’all.”

“I am a 31-year-old, queer Latina public defender whose parents grew up in the Woodside Housing projects,” she continued. “And I decided to run. I ran because for too long, too many communities in Queens hadn’t had a fair shot in our criminal-justice system.”

The party, held at a nightclub in Woodside, was packed shoulder to shoulder with supporters. The Cabán campaign said over a thousand people were in attendance. In tow were the more than dozen elected officials who backed Cabán—sans Ocasio-Cortez—along with her brother and father.

Cabán’s platform was unapologetically progressive in a borough that was once defined by Archie Bunker, the irascible conservative of All in the Family fame. Cabán campaigned as a “decarceral” prosecutor, promising to oppose the construction of new jails, end cash bail, decriminalize sex work, and put far fewer people in prison. Richard Brown, the longtime Queens DA who died in May, was her polar opposite, a tough-on-crime ex-judge who continued to prosecute low-level offenses like turnstile hopping and refused to set up an internal unit to review wrongful convictions.

Two prominent progressive prosecutors, Philadelphia’s Larry Krasner and Boston’s Rachael Rollins, backed Cabán, signaling that New York could join both cities as a leader in a movement that has sought to undo the damage of mass incarceration. Krasner attended Cabán’s election-night party, where chants like “Black lives matter!” and “People power!” erupted throughout the night.

As crime continues to fall nationally, prosecutors are seeking new metrics to measure success. Just as Krasner, a former public defender, became a trendsetter two years ago, a District Attorney Cabán could be a lodestar for big-city prosecutors everywhere. Two of her most famous endorsers, Senators Bernie Sanders and Elizabeth Warren, have already said they are open to decriminalizing sex work.

“Is everyone ready for transformational justice?” asked State Senator Jessica Ramos, a Queens lawmaker who was one of Cabán’s most enthusiastic backers. “Are you emotionally prepared for a new district attorney?”

Queens is a county of over 2 million people, big enough to be one of the five largest cities in America. Brown held the office since 1991. A competitive election for the incredibly powerful post had not been waged in over a half-century.

If Cabán’s lead holds, she could face bitter resistance from the entrenched forces she ran against. Law-enforcement unions aggressively backed a third candidate in the race, Greg Lasak, and rank-and-file police could bristle at cooperating with such a progressive district attorney. Real-estate interests backed Katz to the hilt, as did the city’s largest labor unions. The Queens DA’s office has around 700 employees; to implement the change she promises, Cabán—who has no executive-level experience—may have to purge many of the line prosecutors.

“At the end of the day, I’ve always maintained, and continue to maintain, that this, ladies and gentlemen, is a serious job,” Katz said Tuesday night, in a clear dig at Cabán.

Cabán’s ascent was remarkably quick. She announced her campaign in January and was relatively unknown several months after. The DSA was an early endorser, along with advocates of criminal-justice reform who were seeking an alternative to Katz, a politician who has held office almost continuously since the 1990s. Progressive groups like the Working Families Party lent additional organizational muscle.

On election day, hundreds of volunteers, many with DSA, knocked on doors, canvassed subway stations, and surrounded polling sites. Shortly before the polls closed, Cabán led a jubilant march through Jackson Heights, one of her strongholds.

“This proves how wrong people were to minimize how significant Alexandria Ocasio-Cortez’s victory was,” said Susan Kang, a Queens DSA member and political-science professor who volunteered for both women. “Grassroots campaigns can and will be as powerful as institutional-based campaigns.”

Ocasio-Cortez, who represents a progressive hotbed in western Queens, endorsed Cabán in late May. New cash poured in, from thousands of small donors across America, as well as several millionaires and billionaires who have taken an interest in furthering the movement for criminal-justice reform, like the former hedge-fund manager Michael Novogratz. The New York Times backed Cabán soon after.

Katz’s platform would come to mirror Cabán’s, though her campaign invested in a bevy of TV and digital ads portraying the young public defender as an out-of-touch radical. One Facebook ad even targeted Cabán for playing basketball with voters in the predominately black neighborhood of Jamaica.

Even if Katz somehow survives, the old guard of New York politics has suffered significant damage. Crowley’s loss last year stunned the Democratic establishment. This time, many of them were mobilizing to avoid a repeat. A new party boss, Representative Gregory Meeks, took over from Crowley, and Governor Andrew Cuomo threw his full weight behind Katz.

It took Ocasio-Cortez to drive once-machine-friendly politicians into Cabán’s camp, like the deputy leader of the State Senate, Michael Gianaris. More Democratic power brokers in New York are likely to cozy up to democratic socialists in the future. In a city that once reelected Republicans like Rudy Giuliani, the political shift is palpable—in one generation, unabashed leftists are set to rule.

“We’ve already won without knowing what the final tabulation is,” said Maurice Mitchell, the WFP’s national director. “We’ve already won. We’ve beaten the machine.”