-- Doug Jones, a Democratic former U.S. attorney whose long-shot candidacy was bolstered by a wave of sexual misconduct accusations against his opponent Roy Moore, will win the special election to become Alabama's junior U.S. senator, ABC News can project, based on its analysis of the vote.
With 100 percent of precincts reporting as of 12:00 a.m. ET Wednesday, Jones led Moore by a 49.9-48.4 percent margin, a difference of just under 21,000 votes; slightly more than 22,000 voters cast write-in ballots.
Jones' victory is the first by a Democrat in an Alabama Senate race in 25 years and a powerful rebuke to both the Republican party, which sees it's majority in the Senate cut to a single legislator, and President Donald Trump who supported two consecutive losing candidates in the race to fill Attorney General Jeff Sessions' former seat.
The outcome is also the latest showcase of strength in the ongoing movement of backlash against alleged sexual harassers and assaulters. Starting in early November, Moore faced accusations from eight women that he engaged in sexual misconduct, including that he initiated a sexual encounter with a 14-year-old girl in 1979 when he was 32.
Moore denied all of the claims and steadfastly remained in the race, even as members of his own party called for him to drop out and pledged to initiate his expulsion from the Senate if he were to win. As a result, Jones' campaign received the shot in the arm that resulted in a Democrat capturing one of the state's Senate seats for the first time since Sen. Richard Shelby, R-Ala., then a Democrat, first won election in 1992.
Jones portrayed his win Tuesday evening as a sign to the rest of the country, saying during his victory speech that Alabama showed the U.S. that "we can be unified." He further praised the state for reversing course after a history of what he described as poor decisions.
"Alabama has been at a crossroads, we've been at a crossroads in the past and we've usually taken the wrong fork," said Jones. "Tonight, ladies and gentleman, you took the right road."
Calling it his "lifelong dream" to serve in the Senate, Jones further expressed pride at running a campaign he said was "about dignity and respect" and "common courtesy and decency."
Speaking just after 11:30 p.m. ET, Moore refused to concede, raising the possibility of a recount and saying that he would "wait on God and let this process play out."
"It's not over," said Moore.
Prior to the accusations of sexual misconduct, Moore had already earned a long-standing reputation as a fierce defender of Christianity in the public sphere. His two stints as chief justice ended when he was removed from office for refusing to displace a Ten Commandments monument from the lobby of the Alabama Judicial Building, and, over a decade later when he resigned after he was suspended for ordering state judges to uphold a ban on same-sex marriages.
The Senate race has created a wedge between many prominent Republicans on Capitol Hill, who have maintained that Moore should step aside, and Trump, who endorsed Moore.
While he did not campaign in Alabama, Trump urged voters to support Moore at a weekend rally in Pensacola, Florida, roughly 20 miles from the Alabama state line and close enough to be seen in the Alabama media market.
The president also recorded a robocall over the weekend urging Alabama voters to back Moore.
"Roy Moore is the guy we need to pass our 'Make America Great Again' agenda," Trump said on the call, adding, "Roy is a conservative who will help me steer this country back on track after eight years of the Obama disaster. Get out and vote for Roy Moore."
Trump also argued that Moore has consistently denied the allegations as part of his rationale for endorsing him.
After a number of news organizations projected Jones the winner Tuesday evening, Trump tweeted his congratulations to the Democrat, but pledged the GOP would keep the senator-elect's seat in its sights.
"Congratulations to Doug Jones on a hard fought victory. The write-in votes played a very big factor, but a win is a win. The people of Alabama are great, and the Republicans will have another shot at this seat in a very short period of time. It never ends!"
National Republicans, including Senate Majority Leader Mitch McConnell, R-Ky., called on Moore to step aside in the wake of the sexual misconduct accusations, but Moore remained defiant. Republican senators from Jeff Flake of Arizona to Lindsey Graham of South Carolina expressed views that Moore is not fit to serve, and Flake went so far as to donate $100 to the Jones campaign.
Sen. Cory Gardner, R-Colo., the head of the National Republican Senatorial Committee, said prior to the vote that even if Moore should win the election, he should be expelled from the United States Senate.
Shelby, Alabama's senior senator, was particularly outspoken about not backing Moore.
"I wouldn't vote for Roy Moore. I think the Republican Party can do better," Shelby said Sunday on CNN.
But despite the allegations and widespread backlash against Moore, Jones faced an uphill battle in a state that Trump won by over 20 points in 2016.
Moore strongly embraced the president, and painted Jones, who was appointed as a U.S. attorney by Bill Clinton in 1997, as too liberal on issues such as illegal immigration, abortion and same-sex marriage.
Jones, in turn, pitched himself as a politician who would reach across party lines, and ran a campaign focused on turning out African American voters and Alabama Republicans skeptical of the former chief justice both before and after the allegations of sexual misconduct surfaced.
This past weekend Jones campaigned across the state with numerous high-profile African-American politicians, including Sen. Cory Booker, D-N.J., and Alabama's only Democrat in the House, Rep. Terri Sewell, D-Ala.
Jones further saved his fiercest attacks on Moore for the final weeks of the campaign.
“I damn sure believe that I have done my part to ensure that men who hurt little girls should go to jail and not the U.S. Senate," Jones said at a campaign rally in Birmingham last week.