Supporters of Democratic Alabama U.S. Senate candidate Doug Jones celebrate at the election night party in Birmingham, Alabama, U.S., Dec. 12, 2017.
Supporters of Democratic Alabama U.S. Senate candidate Doug Jones celebrate at the election night party in Birmingham, Alabama, U.S., Dec. 12, 2017.

Washington awoke Wednesday to a political earthquake after Democrat Doug Jones won an upset victory for a Senate seat in Alabama, the first time in a quarter century Republicans have lost a Senate election in the deeply conservative southern state.

It was a major rebuke for U.S. President Donald Trump, who had called for the election of Republican Roy Moore, a state supreme court justice who had twice been tossed off the court for failing to adhere to federal court rulings and then faced allegations from women who accused him of sexual misconduct four decades ago when they were in their teens and he was in his early 30s.

Trump congratulated Jones, but also claimed he knew all along that Moore would not win the election because "the deck was stacked against him!"

It was a self-inflicted political wound for Trump, who 13 months ago had carried Alabama by 28 percentage points as he won the presidency.

Numerous political advisers had urged Trump to stay out of the Jones-Moore race.

But the president joined former chief White House strategist Stephen Bannon, an alt-right political operative actively opposed to the Republican political establishment in Washington, in a full-bore endorsement of Moore.

Trump wrote numerous Twitter comments supporting Moore, called for his election at a rally last week and disparaged Jones as a "puppet" of the top two Democratic lawmakers, Senate Minority Leader Charles Schumer and House Minority Leader Nancy Pelosi.

After a contentious campaign, voters backed Jones, a former federal prosecutor, over Moore by about 20,000 votes out of more than 1.3 million ballots cast, a margin of 49.9 percent to 48.4 percent.

Democratic candidate for U.S. Senate Doug Jones th
Democratic candidate for U.S. Senate Doug Jones thanks supporters as he holds his wife Louise's hand Tuesday, Dec. 12, 2017, in Birmingham, Ala.

The result means that in January when Jones is sworn in, the Republican majority in the 100-seat Senate will shrink from 52-48 to 51-49 and make it tougher for Trump to win approval for his legislative agenda.

A leading Republican lawmaker, Senator John Cornyn of Texas, told VOA the lesson Republicans should take from the election is that "flawed candidates lose."

In a Twitter comment, Trump explained why he originally endorsed Senator Luther Strange in a Republican primary election against Moore.

In another assessment, Trump said, "If last night's election proved anything, it proved that we need to put up GREAT Republican candidates to increase the razor thin margins in both the House and Senate."

Numerous key Republican figures, including Senate Majority Leader Mitch McConnell, House Speaker Paul Ryan and two former presidential candidates, Senator John McCain and Mitt Romney, all to no avail urged Moore to drop out of the race after two women, now in their 50s, accused Moore of molesting them when they were teenagers.

Several Republican lawmakers said they would have launched an effort to expel him from the Senate had he won. Moore's defeat ended the likelihood that Republicans would have had to constantly answer questions about the allegations against him.

Jones told cheering supporters at his victory party Tuesday night, "We have shown not just around the state of Alabama, but we have shown the country the way, that we can be unified."

Democratic Alabama U.S. Senate candidate Doug Jone
Democratic Alabama U.S. Senate candidate Doug Jones acknowledges supporters at the election night party in Birmingham, Alabama, Dec. 12, 2017.

Exit polls showed Jones winning by huge margins over Moore from African-American voters and white liberals, while also capturing some Republicans voters disturbed by sexual misconduct allegations against Moore. The Republican won wide support from Republican party faithful and evangelical Christians drawn to Moore's frequent biblical references at his campaign rallies.

Republican U.S. Senate candidate Roy Moore, center
Republican U.S. Senate candidate Roy Moore, center, looks at election returns with staff during an election-night watch party at the RSA activity center, Dec. 12, 2017, in Montgomery, Alabama.

?Moore, at his own rally, did not concede the election to Jones, suggesting he would pursue a recount.

"It's not over. It's going to take some time," he said.

But Jones's margin of victory exceeded the half percentage point threshold mandating a recount in Alabama elections. State Republican chairman Terry Lathan signaled in a statement Wednesday he did not support a recount.

Lathan said Republicans are "deeply disappointed" in the outcome, but that the contest has "ended."

Jones, who said he was "overwhelmed" by the victory, did not specifically reference Moore in his victory speech, but assessed the campaign.

"This entire race has been about dignity and respect. This campaign has been about the rule of law," Jones said. "This campaign has been about common courtesy and decency and making sure everyone in this state regardless of which zip code you live in is going to get a fair shake in life."

Senator Jeff Flake, a Republican who has announced he will not be running for re-election in his state of Arizona, posted on Twitter last week a picture of a campaign donation he made to Jones. He followed that Tuesday night with a post that said, "Decency wins."

Democratic Senator Cory Booker of New Jersey campaigned alongside Jones and said Alabama "gave the whole country a needed renewal of hope and the first ray of light of a rising sun and a coming new day."

Former Vice President Joe Biden, a Democrat, told CBS on Wednesday, "Probably some of the happiest people in America today are the Republicans in the Senate," not having to answer for Moore in the coming months.

"No. I genuinely mean it," Biden said. "What I mean by that is that the divisiveness that was caused within the Republican party by Bannon and all the sort of bile that comes out of the administration is just — I know the majority of the members on the Republican side and they're decent people. They're not comfortable in this territory."

Jones will fill out the remaining three years of the Senate seat once held by Jeff Sessions, who resigned to join Trump's Cabinet as attorney general, the country's top law enforcement position.

Mike Bowman contributed to this report.