Doug Jones made an appeal for "decency" to prevail over partisanship. Deeply conservative Alabama apparently listened, overturning a quarter-century of voting habits to elect him on Tuesday night in a stunning rebuff of the president, of an anti-establishment insurgency and of sexual harassment in Congress, Alabama politicos said.

Jones, a former prosecutor, became the first Democrat in 25 years from the deeply red state to be elected to the U.S. Senate seat, edging out his Republican rival Roy Moore, an accused child molester and Bible-quoting former judge, in a test of the limits of political tribalism.

Jones's upset victory on reliably red soil suggested Moore's alleged sexual predation of teen girls when the ex-jurist was in his thirties may have been too much for Republican voters to stomach.

Moore denies the allegations.

'Voters will only be pushed so far'

"Turnout didn't decide the election," tweeted Republican Alabama strategist Blake Harris, noting that some 22,000 votes were recorded as write-ins for alternative candidates. "Republicans who showed up but who couldn't bring themselves to vote for Moore decided it."

"This shows there are limitations to partisanship. Even in a Republican state," Zac McCrary, a Democratic pollster, said from Jones's Birmingham victory party. "Voters will only be pushed so far. And then they push back. That's what happened tonight."

USA-ELECTION/ALABAMA

Republican U.S. Senate candidate Roy Moore pauses as he addresses supporters at his election night party in Montgomery, Ala. Moore's loss spells trouble for the so-called Trump effect. (Carlo Allegri/Reuters)

He said Alabamians were tired of being "embarrassed" by politicians.

For U.S. President Donald Trump, the upset victory by Jones throws into doubt the value of his political capital, with the commander-in-chief now 0-2 in Alabama Senate races. Trump supported Republican candidate Luther Strange in the primary before Strange lost to Moore. Trump then endorsed Moore, to no avail.

The result spells trouble for the so-called Trump effect, said Joseph Smith, chair of the political science department at the University of Alabama.

"Donald Trump is not a kingmaker," he said. "He does not have enough influence over voters to change races."

'Earth-shaking for Alabama'

Establishment Republican lawmakers who felt pressured for the sake of their seats to abide by the president's agenda might now feel more emboldened to buck some of his policies, as well as the populist movement within the party, Smith said.

"This changes the calculus for current Republican senators," he said, "because I think they'll be less fearful of primary challenges" being boosted by Breitbart Media rabble rouser Steve Bannon.

The Democratic party has been "dead" in Alabama state-wide elections for a quarter of a century, Smith noted. "So to win this state-wide race is earth-shaking for Alabama."

USA-ELECTION/ALABAMA/BANNON

Political strategist Stephen Bannon speaks at a Moore campaign rally in Midland City, Ala., on Monday. (Carlo Allegri/Reuters)

"If Steve Bannon and Donald Trump couldn't produce a winner in Alabama, you have to wonder if they can produce a winner anywhere."

Republican Alabama strategist Jonathan Gray sees a clear opportunity for Democrats.

Republicans now have an even slimmer margin for error, with 51 seats to the Democrats' 49. Losing two votes could doom their legislative efforts, including their top legislative priority: Tax reform.

'Realistic path' to victory for Democrats

Meanwhile, Democratic prospects for reclaiming a Senate majority now appear brighter for next year's midterm elections.

To his chagrin, Gray said, Democrats can "absolutely" retake the Senate in November 2018. Republican-held seats in Arizona, Tennessee and Nevada could be in play for Democrats next year.

USA-ELECTION/ALABAMA

Supporters celebrate at Jones's election night party. (Marvin Gentry/Reuters)

McCrary, the pollster, said Democrats have at minimum a "realistic path" to a Senate majority, "which, six months ago, was very much in question."

Trump congratulated Jones in a tweet. However, Moore refused to concede defeat in the down-to-the-wire election, even though the numbers required to trigger a recount were "highly unlikely," in the words of Alabama's secretary of state.

Moore not ready to admit Alabama defeat.0:33

Moore no longer a Republican 'problem'

Gray allowed that Republicans might be secretly relieved by Moore's loss, given the toxicity of the sexual misconduct allegations trailing him. The Republican Party, which has long positioned itself as the party of family values and virtue, won't have to reckon with having an alleged child molester helping to define the future of legislation.

"Democrats wanted to be able to hang Roy Moore around the necks of every Republican running in the midterms," he said.

USA ALABAMA SENATE ELECTION ROY MOORE

Moore arrives on horseback to vote in the town of Gallant. Moore was never a strong candidate to begin with, one Republican strategist argued. (Dan Anderson/EPA-EFE)

Moore joining the Republicans in Washington would have also triggered a difficult debate about whether he should be expelled on moral grounds, a decision that might have been perceived as overturning the democratic will of Alabama constituents.

"Well, guess what? That's not a problem. Roy Moore is gone, he's been defeated," Gray said. "Republicans are going to say, 'We stood up and did the right thing.' So slow down, take a breath."

Moore, he said, was never a strong candidate to begin with.

A political aberration

Indeed, Moore only got 51.7 per cent of the vote for chief justice of Alabama's Supreme Court in 2012, the same election in which Republican presidential candidate Mitt Romney captured 61 per cent of the vote. 

Not only did Moore face accusations of attempted rape and predatory behaviour toward teen girls, he was also outspent five-to-one by Jones's campaign and received only a belated endorsement from the president with just a week before the election. And yet Jones only managed to eke out a narrow win.

Doug Jones

Jones checks in to receive his ballot before voting at Brookwood Baptist Church in Mountain Brook, Ala. He'll have to defend his seat in another election in 2020. (Justin Sullivan/Getty Images)

"Unless you have horrendous sexual allegations against every Republican you're running against in the midterms, I'm not sure this screams midterm turnaround," Gray said.

While Gray said he didn't want to take away from a big win for Democrats, he warned Tuesday's historic outcome should be analyzed in isolation as a political aberration.

Doug Jones will run for re-election in 2020, he said. "Now here's the bad news: I doubt he runs against another Roy Moore in the future."