Democrat Doug Jones won the Alabama special election on TuesdayCarlo Allegri / Reuters

In a major upset, Democrat Doug Jones won the Alabama Senate special election on Tuesday to fill the seat previously held by Attorney General Jeff Sessions. The last time the deeply conservative state sent a Democrat to the Senate was in 1992.

The race abruptly turned competitive after multiple women alleged that Republican Roy Moore made advances toward them as teenage girls, including groping and assault. The result is a stunning victory for the Democratic Party, which has struggled to win back power in Washington since losing the White House in 2016.  

Moore did not immediately concede on Tuesday, but Alabama Secretary of State John Merrill told CNN it is “highly unlikely” that Jones would not be certified as the winner.

The election deals a blow to President Trump, who endorsed Moore, and former White House strategist Steve Bannon, who campaigned on Moore’s behalf. Trump congratulated Jones on Tuesday evening, tweeting that “a win is a win.”

Parallels between Moore’s political trajectory and President Trump’s are inescapable. Multiple women publicly accused Trump of sexual harassment and assault during his run for president. Trump denied the allegations, called the women liars, and won the presidency. That playbook didn’t work for Moore.

“Tonight is a night for rejoicing," Jones said Tuesday evening to a cheering crowd. Referencing a Martin Luther King quote, Jones said: “The moral arc of the universe is long but it bends toward justice. Tonight, you helped bend that moral arc a little closer to justice."

The outcome of the election has immediate and potentially far-reaching consequences that stand to benefit the Democratic Party. Flipping a Senate seat narrows the already razor-thin Republican majority in the chamber, and will make it harder for Republicans to pass any significant legislation. It might even jeopardize the Republican tax overhaul effort currently underway in Congress. Democrats face an uphill battle to win back the Senate in 2018, but winning a seat in the Alabama race nevertheless improves the party’s odds. Jones will hold the seat until 2020.

Jones is a former U.S. attorney known for prosecuting members of the Ku Klux Klan for the bombing of a black Baptist church in Birmingham in the 1960s, an attack that left four girls dead. Despite campaigning in solidly Republican territory, Jones has run as a pro-choice, pro-immigrant-rights Democrat.

Moore is a former Alabama Chief Justice who gained notoriety for defying federal court orders to take down a monument to the Ten Commandments and refusing to uphold the legality of same-sex marriage. Moore has denied the allegations of sexual assault he faces and called them “ritual defamation.”

The race fundamentally changed in November when The Washington Post reported allegations from a woman named Leigh Corfman who said Moore molested her  when she was 14-years-old and Moore was 32-years-old. Since then, more women have come forward with allegations of sexual misconduct.

That controversy played out against the backdrop of a national reckoning over alleged sexual harassment by powerful men. The #MeToo movement has taken down men accused of misconduct everywhere from Hollywood to Congress. Even so, it seemed possible that Moore would still win his race.

Moore’s standing in the polls fell dramatically after the Post report. But by Tuesday morning, the Republican candidate had re-gained an edge over Jones. Pundits and pollsters warned that it was impossible to predict who would win.

After sexual misconduct allegations against Moore first emerged, the Republican National Committee initially cut ties. Senate Majority Leader Mitch McConnell said he should “step aside.” The distancing act didn’t last long. By early December, the RNC had restored its financial backing for Moore, after Trump endorsed him. McConnell later said that it’s up to the voters of Alabama to “make the call” on whether Moore should be elected to the Senate.

The Democratic Party, for its part, will be sure to keep reminding voters of the ties between the GOP establishment, the president, and Moore. In a statement celebrating the victory, Democratic Senatorial Campaign Committee Chair Chris Van Hollen said the election showed that voters “soundly rejected the new Republican Party of Roy Moore and Donald Trump and their toxic agenda.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.