“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.