For the first time since 1992, a Democrat has won a US Senate election in Alabama.

It’s a stunning reversal in one of the reddest states in the union, made possible not so much by the strength of the Democratic candidate but by the astonishing weakness of the Republican nominee. A glib commentator might conclude that all the election shows is that a Democrat can win a federal election in Alabama if his opponent has been fired from the state Supreme Court twice for misconduct and faces multiple credible accusations of preying on teenage girls.

But while the circumstances are peculiar, the consequences are immense. Doug Jones’s election to the Senate weakens Republicans’ already tenuous grip on that body, throwing passage of a Republican tax bill into doubt and making a Democratic takeover in the 2018 midterms look more like a real possibility.

Longer term, the fact that Jones could win gives hope to Democratic efforts in slightly less red states like Georgia and Texas. Jones could not have won without overwhelming support from Alabama’s black community, and his victory suggests that Democratic coalitions in Southern states where the nonwhite share of the population is rising can be tenable, if enough white voters can be persuaded to defect from the Republicans.

Here’s who left Tuesday night better off, and who left defeated.

Winner: Doug Jones

We might as well start with the obvious one. Doug Jones entered this race as a sacrificial lamb. The last time this seat was up for election in 2014, Jeff Sessions ran literally unopposed; he won 97.3 percent of the vote against a write-in Democratic candidate. The last time it was actually contested, in 2008, Sessions got 63.36 percent.

Every indication was that if Luther Strange, the senator appointed to fill Sessions’s spot, or Rep. Mo Brooks had won the nomination, Jones would’ve lost in a landslide. Jones had never been elected to public office before this race, and his last role in government, as United States attorney for Northern Alabama, ended when Bill Clinton left office nearly 17 years ago.

But Jones was a reasonably qualified candidate. He made his name as a widely respected prosecutor who launched the successful prosecutions of Thomas Edwin Blanton Jr. and Bobby Frank Cherry, two of the Ku Klux Klan members involved in the 16th Street Baptist Church bombing, which killed four young black girls in Birmingham in 1963. It was one of the most infamous crimes of the civil rights era, and one for which Blanton and Cherry had gone unpunished for nearly four decades, although the FBI knew of their involvement as early as 1964. After leaving office, Jones remained a respected lawyer in private practice in Birmingham.

That résumé is normally not enough to overcome Alabama’s overwhelming Republican tilt. But this race is a reminder of why it’s important for parties to run plausible candidates every single time.

In 2012, for instance, the Democratic Party nominated Mark E. Clayton, a fringe anti-gay conspiracy theorist who had raised literally no money, to run against Sen. Bob Corker in Tennessee. No one more qualified had even bothered to run. It’s unlikely that a more qualified person could’ve beaten Corker. But if Corker had lost in a shock primary defeat to, say, a disgraced ex–state Supreme Court justice with a record of accusations of sexual misconduct, Democrats would not have been able to seize the opportunity.

In the 2017 Alabama race, the Democrats didn’t nominate a Mark E. Clayton. They nominated a Doug Jones. It’s an essential reminder to both parties of the importance of contesting every race seriously. If Democrats had phoned in this race from the start, Roy Moore would be a senator-elect right now. Because they didn’t, Alabamians had a plausible alternative to electing an accused sexual predator — an alternative they understandably embraced.

Loser: Roy Moore

This isn’t just an electoral loss for Roy Moore. It is, in all likelihood, the end of his political career.

Moore is 70 years old, and his two victories in state Supreme Court races in 2000 and 2012 remain his only election wins. The latter was embarrassingly close: Moore ran only 4 points ahead of his Democratic opponent, winning 52 percent of the vote in a year when Mitt Romney won Alabama with 61 percent.

Both stints ended with him being effectively forced out of office in extremely public and humiliating fashion, first for refusing to obey a federal court order mandating that he remove a Ten Commandments monument from the Alabama Judicial Building, and then for instructing lower-court judges to ignore the US Supreme Court’s rulings legalizing same-sex marriage. (In that case, he technically resigned after being suspended.)

Moore has tried for higher offices in the past. He briefly considered a 2004 third-party run. He ran in the Republican gubernatorial primaries in 2006 (against incumbent Gov. Bob Riley) and 2010 (in an open race when Riley was term-limited). In the former election, he was trounced by a 2-to-1 margin. In the latter, he came in fourth. In 2012 he weighed a presidential run, first as a Republican and then, when it became clear he'd fail badly in the GOP race, as a member of the far-right Constitution Party.

Effectively, until the 2017 Senate race, Moore was at best an Alabama Republican with middling appeal, and at worst the state’s answer to Harold Stassen: a frequent candidate who rarely, if ever, won or even came close to winning top-tier races.

Tuesday’s result makes clear that Moore can’t be counted on to win statewide races that literally any other Alabama Republican could have won. Winning as the Republican nominee in Alabama is perhaps the lowest possible bar for an American politician to clear, and Moore couldn’t clear it.

There are races Moore could contest in the future. He could run for governor in 2018. He could challenge Jones for reelection in 2020, or run for the state’s other Senate seat in 2022, whether or not incumbent Richard Shelby (who’ll be 88) retires.

But why in the world would Alabama Republican voters nominate him after this pathetic showing? Why would they run a candidate against Jones who had already lost to Jones? Why would they pick a known loser? The unique set of circumstances that enabled Moore’s primary win this year are unlikely to repeat themselves. In all probability, this is the end of the road for Justice Moore.

Winner: the anti–sexual harassment movement

In the most minimal of senses, the surging movement against sexual harassment and assault in politics and other realms won Tuesday night — a man facing multiple credible accusations of sexual assault and predation was kept out of the US Senate.

But more importantly, he was kept out largely because he faced multiple credible accusations of sexual assault and predation. Look at RealClearPolitics’ polling average for the race. The Washington Post’s blockbuster story on the accusations of sexual assault against Moore broke on November 9:

Immediately after the accusations landed, the race tightened dramatically, with Jones briefly taking a lead in the polling average a week or so later. That's partly an artifact of how little the race was polled before the accusations, and there are plenty of reasons to be skeptical of all polling data coming out of the race. It's just really hard to predict turnout, as pollsters must, in an election this strange. But what data we have suggests that the revelations did make a difference, and narrowed the race substantially, creating an opening for Jones.

The Alabama race didn’t just show that there are consequences for sexual harassment for (at least some) Republican politicians. It helped bring about consequences for Democrats. It is doubtful that Al Franken would’ve been pushed so strongly to resign from the Senate had it not looked really bad for Democrats to be protecting one of their own from harassment allegations while using harassment allegations to attack Moore.

The 2016 election was a low-water mark for electoral punishment of sexual harassers. The Republican Party nominated a candidate who faced more than a dozen serious accusations, who allegedly walked into dressing rooms full of naked teenage girls, and supported him to victory and unified government. The 2017 special election, by contrast, was a hallmark example of voters taking harassment claims seriously and rejecting a candidate accordingly.

Loser: Mitch McConnell

Mitch McConnell’s record in the case of Roy Moore is … spotty. When sexual harassment accusations against Moore emerged, McConnell’s response was initially strong. He stressed that he believed the accusations, and that he thought Moore should exit the race. While he stopped short of his colleague Sen. Jeff Flake, never suggesting that voters support Doug Jones instead, he did say Alabama voters might write in another Republican, such as Attorney General Jeff Sessions.

Then McConnell got wobbly, telling CBS News, “The people of Alabama are going to decide … who they want to send to the Senate. It's really up to them. It's been a pretty robust campaign with a lot of people weighing in. The president and I of course supported somebody different earlier in the process. But in the end the voters of Alabama will make their choice.”

Around the same time, the Republican National Committee resumed its monetary support of Moore’s campaign. McConnell doesn’t control the RNC. But he presumably could’ve pressured the committee to hold back if he passionately opposed aid to Moore. That he didn’t, and that his public comments went from condemnatory to noncommittal, spoke volumes.

Now McConnell is in an unenviable position. He put his character on the line by failing to forcefully condemn Moore in the campaign’s final days, and it didn’t pay off. Now he has a weakened Senate majority, which could make confirming Trump’s judicial and executive appointees, and achieving favorable spending deals with Democrats, rather difficult. It could even endanger tax reform if Republicans’ plan to rush a bill through next week (before Jones takes office) doesn’t work out.

He’s one seat closer to losing the Senate, and he’s lost another chunk of his dignity in the process.

Winner: Ruth Bader Ginsburg’s legacy

This is a bit circuitous, and doesn’t even touch on Ginsburg’s long career fighting against all forms of gender discrimination (including sexual harassment), but bear with me for a second.

Democrats’ odds of retaking the US Senate in 2018 are, as it stands, not that great. Both 2006 and 2012 were strong Democratic years, and as a result, most seats up in 2018 are already controlled by the Democrats: 25 are in Democratic or Democrat-aligned independent hands, and only eight are controlled by Republicans. Ten are in states won by Donald Trump. Only one Republican-held seat in a state Hillary Clinton won is up for reelection in 2018. To retake the Senate before the Alabama election, Democrats would’ve needed to win three of the Republican seats while holding all 25 of the Democratic ones. The math was rough, to say the least.

The challenge got less imposing for a number of reasons at the end of 2018. First, Dean Heller of Nevada, the one Republican up for reelection in a Clinton state, saw his popularity collapse as he collaborated on Obamacare repeal efforts. Then Republican Bob Corker of Tennessee announced his retirement — and popular former Democratic Gov. Phil Bredesen announced a bid for the seat. Then Democratic Arizona Rep. Kyrsten Sinema, a popular representative from a swing district, announced she’d run against Sen. Jeff Flake, who, facing both Sinema and a potent right-wing primary challenge, announced his retirement as well. Those, right there, were the three races Democrats needed to win, and they were starting to look winnable.

Then Doug Jones won a seat in Alabama, of all places, and reduced the number of seats Democrats needed to net to only two. Democrats could lose one of their incumbents’ seats, and, as long as they win Nevada, Tennessee, and Arizona, still retake the Senate. Or they could hold all their incumbents’ seats and win only two of those three pickups. The path to a majority is still tough. But with Jones’s win, it got much, much easier.

A Democratic majority come 2019 wouldn’t be able to do much legislatively. But what it could do is block any Trump Supreme Court nominee — or perhaps, in an echo of McConnell’s Court strategy in 2016, block any nominee not named “Merrick Garland.”

Control over Supreme Court appointments always matters. But it definitely matters when one of the five Supreme Court justices who reliably support abortion and LGBTQ rights is an 84-year-old two-time cancer survivor, and another is an 81-year-old Republican who happens to believe in the right to choose and LGBTQ equality.

It is not an exaggeration to say that if Trump were to replace Ruth Bader Ginsburg or Anthony Kennedy with a justice of his choosing, Roe v. Wade would likely not survive. There would be five conservative votes to overturn it, and to establish a new era of conservative jurisprudence in a variety of domains, from campaign finance to business regulation to prison sentencing.

Republicans understand that this is the long game (or even the near- to medium-term game). When Sen. Ben Sasse (R-NE) admonished Flake for giving money to Doug Jones in the Alabama race, he equated support for Jones with support for late-term abortion:

This donation is a bad idea.

It's possible to be against BOTH partial birth abortion AND child molestation. Happily, most Americans are. https://t.co/BjVH2gL69F — Ben Sasse (@BenSasse) December 6, 2017

This is not an accurate representation of Jones’s views (he opposes late-term abortion except in medical emergencies), but Sasse isn’t really talking about Jones. He’s talking about the Court. He’s talking about what happens when Ginsburg or Kennedy leaves. He’s talking about how tantalizingly close the anti-abortion movement is to achieving its paramount goal of the past 44 years, and how much a Jones victory disrupts their planning.

A Jones win could even be a problem even if Democrats don’t retake the Senate. Sens. Susan Collins and Lisa Murkowski, both Republicans, both voted in 2003 for a resolution affirming the importance of Roe v. Wade, and identify as at least somewhat pro-choice. They and Jones together are enough to sink any Trump nominee for the Supreme Court. Whether Collins and Murkowski hold firm is, of course, a major question. But it’s not inconceivable they and Jones could force a more moderate nominee, a Kennedy instead of an Alito.

That would be a disaster for Sasse and pro-life activists in the Republican Party. But it would be very good indeed for Ruth Bader Ginsburg’s legacy, especially if the seat at stake is her own.