Media playback is unsupported on your device Media caption What the Alabama upset will mean for Donald Trump's agenda

Christmas has come early for Democrats, who notched a surprise win in Alabama in one of the most unpredictable, improbable Senate races in modern memory. But what kind of mark will this vote leave on US politics?

The last time Alabama elected a Democratic US senator was 25 years ago.

Since then the state has been moving steadily to the right - in 2016, Donald Trump defeated Hillary Clinton there by nearly 30 points.

There are few, if any, US states as ruby-red conservative. And yet a plurality of voters have sent Democrat Doug Jones to the US Senate.

There is a risk in reading too much into these results in Alabama, given the unique circumstances.

The Republican candidate had a cloud of controversy hanging over his head - not just from allegations of sexual impropriety, but also a history of inflammatory statements and legal run-ins that knocked him out of the Alabama Supreme Court twice.

The former judge had a loyal base of support, but there were traditionally Republican voters who found his views on homosexuality, Muslims and civil rights distasteful.

Despite his obvious flaws as a candidate with any broad appeal, the impact of this defeat will be felt in several ways.

1. An energised left

Prior to election day, Alabama officials estimated that about 20% of Alabama registered voters would show up to vote in this special election.

The latest figures put that number closer to 40%. Roughly 1.3 million ballots were cast in the state, and in county after county Democrats exceeded expectations, particularly compared to turnout from Republicans in their party's rural and suburban strongholds.

It's a trend that echoes the results in Virginia - the other big electoral test of 2017. In November, Democratic voter participation in that more narrowly-divided state surged, carrying the party's candidate for governor to an easy victory and nearly winning enough seats to take control of the state legislature.

Progressives have touted their "resistance" to the Trump presidency, and it appears that - at least so far - their enthusiasm is translating into numbers at the ballot box. That will bode well for the party's prospects in the big congressional mid-term elections that loom on the horizon in November 2018.

Among Democratic voters, African-Americans went to the voting booths in particularly strong numbers and voted overwhelmingly for Mr Jones.

According to exit polls, they accounted for nearly 30% of Tuesday's electorate, while only making up 26% of the state's total population. In 2016 lower black turnout proved costly for Mrs Clinton in states like Michigan, Wisconsin and Florida. In Alabama they were the Democratic lifeline.

Image copyright Getty Images Image caption Doug Jones supporters were ecstatic

2. Steve Bannon humbled

Roy Moore was supposed to be Steve Bannon's first big victory, a cannonball fired into the heart of the Republican establishment and a visible example of the populist-evangelical electoral alliance he was crafting.

Instead, the former Trump campaign head and senior White House adviser has been humbled. His candidate, it turns out, was deeply flawed and he ended up losing what should have been a slam-dunk Senate election.

Mr Bannon has declared all-out war against Republican Senate Majority Leader Mitch McConnell, whom he views as insufficiently supportive of Mr Trump's "America first" agenda, and promised to field 2018 primary challengers against every Republican senator running for re-election save Texan Ted Cruz.

If Mr Moore had prevailed, Mr Bannon would probably have found plenty of volunteers ready to lead the charge and deep-pocketed benefactors to finance the efforts.

Now, however, instead of claiming his first scalp, he will be blamed by leaders in his party for narrowing the Republican Senate majority and damaging the party's brand.

Image copyright Getty Images Image caption Bannon stuck with Moore when other Republicans deserted him

3. Trump takes a hit

On Tuesday night, a magnanimous president took to Twitter to congratulate Mr Jones on his Senate victory.

This probably won't be the president's last word on the matter but for now, his reaction could reflect an acknowledgment that despite his support for Mr Moore, it wasn't enough to pull his man over the finish line, even in conservative Alabama.

Other top officials in the Republican Party were reluctant to back Mr Moore, particularly after the Washington Post allegations of sexual misconduct were revealed, but Mr Trump steadily ramped up his backing for the beleaguered candidate.

If the president or his aides take a closer look at the state's exit polls, there is certainly cause for concern, as 41% of Alabama voters "strongly disapproved" of the president, while only 32% "strongly approved".

While Mr Trump may dismiss opinion surveys that show his approval ratings in the mid-30s nationally, the Alabama results are actual voters casting actual ballots.

Elections don't lie, and the election results have a serious message for the president less than a year into his term.

4. The US Senate is in play

The Republican majority in the Senate narrows to 51-49, and the party can only afford to lose a single vote on any measure, thanks to Vice-President Mike Pence's power to break a tie.

Mr Jones probably won't be seated until early January, which means the Republicans still have time to pass their tax-cut bill and vote on any year-end budgetary resolutions, but after that the window for legislative success narrows considerably.

More than that, it also puts control of the Senate squarely in play in the 2018 mid-term congressional elections.

Democrats have to defend a number of at-risk seats - in Trump-leaning states like Missouri, Indiana, West Virginia and North Dakota - but if their incumbents manage to hold on, there are two clear pick-up opportunities in Nevada and Arizona.

If they had lost the Alabama race, the next tier of states - Tennessee and Texas - were much bigger reaches.

Of course, Alabama has shown that, given the right confluence of candidates and controversy, anything is possible.

5. A #MeToo reckoning?

In the past week, three members of the US Congress - two Democrats and one Republican - have announced their resignations because of reports of sexual impropriety.

While their actions hinted that there would be a political price in the new environment of sexual-harassment sensitivity, the true test would come at the ballot box.

Mr Moore faced accusations - which he denied - of improper relations with teenage girls when he was an assistant district attorney in his 30s.

It appeared possible that Alabama voters would elect him to the Senate anyway, with Mr Moore's supporters arguing that their man had been vindicated or, perhaps, absolved by the voters.

It's a line of defence not too different from the one being constructed by the White House, as allegations made by more than a dozen women President Donald Trump have received renewed consideration.

Media playback is unsupported on your device Media caption Jessica Leeds is calling on Congress to open an inquiry into President Trump

"The people of this country, at a decisive election, supported President Trump, and we feel like these allegations have been answered through that process," White House Press Secretary Sarah Huckabee Sanders said on Monday.

In Alabama, however, Mr Moore won't have a chance to make that argument.

It's not clear how much the allegations played a part in his defeat but politicians across the US will surely be taking note.