(CNN) President Donald Trump woke to a self-inflicted political disaster Wednesday morning that even he could not chalk up to fake news, after Republican Roy Moore crashed to defeat in the Alabama Senate race.

Completely disregarding the advice of top Republicans, Trump had thrown himself unequivocally and comprehensively behind Moore -- and so the deeply flawed Republican candidate's upset loss on Tuesday is now his own.

Trump had argued that notwithstanding allegations of sexual abuse whirling around Moore, Republicans should vote for him anyway because he would be better than a Democrat who would be weak on crime, the military and borders.

But in an effort to save face on Wednesday, he insisted he had actually had it right all along -- recalling his earlier support for incumbent Sen. Luther Strange in a primary, before he was defeated by Moore, in what was seen at the time as another bad political bet by the President.

"The reason I originally endorsed Luther Strange (and his numbers went up mightily), is that I said Roy Moore will not be able to win the General Election. I was right! Roy worked hard but the deck was stacked against him!" Trump tweeted

But the stunning win by Democrat Doug Jones in one of the nation's most conservative states raised questions not just about Trump's political acumen but also over whether his remarkable run, in which he crushed convention and defied political gravity, is beginning, finally, to run out of steam.

Moore's loss also put the fate of the President's agenda on the line, with the GOP majority in the Senate now shaved to just a single vote and the chamber one step closer, though still a long shot, to being up for grabs in midterm elections next year.

In his first reaction to the loss, Trump was unusually chivalrous, congratulating Jones and bemoaning the write-in votes that helped doom Moore.

"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!" Trump tweeted.

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! — Donald J. Trump (@realDonaldTrump) December 13, 2017

Whether the President's mood remains as upbeat once he has had time to brood on his humiliation is not clear. It is still more uncertain whether he will interpret Tuesday's loss as a cue to moderate his behavior, which may have dampened Republican turnout. He spent Tuesday escalating a confrontation with Democratic Sen. Kirsten Gillibrand in which he was accused of making a tasteless sexual reference.

Signs of hope for the Democrats

There was jubilation for Democrats, who embraced an unlikely hero in a state they never thought they could win. There is a sense, building on Democratic victories in Alabama and last month in Virginia, that the mood in the country is beginning to turn the party's way.

"We have been at crossroads in the past. And unfortunately we have usually taken the wrong fork," Jones said in his victory speech, referring to the history of a state torn by racial and cultural divides.

"Tonight, ladies and gentlemen, you took the right road."

Thirteen months after one of their darkest hours turned into a yearlong funk after Hillary Clinton's defeat, party activists now have reason to believe again and will enter the new year with real hopes of making noise in 2018.

The result suggested that in the right circumstances with an engaged base vote, especially with African-Americans showing up in larger-than-expected numbers, Democrats could punch a hole in the Trump coalition of rural, working-class voters attracted by the President's populist nationalism and evangelicals sticking with him largely over issues like Supreme Court nominations.

Tuesday night will also send a chill through Republican ranks as lawmakers consider whether the race was an outlier or, along with last month's Virginia elections, could signal a building anti-Trump backlash that could sweep them away next fall.

A public reckoning

The Alabama special election also came at an extraordinary moment in American political life -- with allegations against Moore coinciding with an awakening over sexual harassment against women in politics, the media and entertainment.

The question must now be whether the force of that movement begins to reshape politics itself ahead of the midterms next year and Trump's re-election race in 2020, and whether the allegations of sexual misconduct against the President himself now begin to become a greater political liability.

One of Trump's biggest critics, GOP Sen. Jeff Flake, who has criticized the President's moral leadership, summed up the result in a simple tweet: "Decency wins."

Decency wins — Jeff Flake (@JeffFlake) December 13, 2017

By siding so closely with Moore, Trump has given Democrats an opening to argue that he supported an accused child molester for his own political gain.

A source close to the White House told CNN's Jim Acosta the the result was "devastating for the President" and an "earthquake."

The source also suggested that the President had been led into a poor political spot by his former top chief strategist Steve Bannon, who had embraced Moore as an archetype of the anti-establishment army he wants to take over the GOP.

"The President has egg on his face" because of Bannon, the source said.

While every top Republican rejected Moore, showing revulsion about the charges of sexual abuse against him, Trump insisted that there was no alternative to sending Moore to the narrowly divided Senate, to save his own agenda.

But in the end, the President could not pull a badly flawed candidate across the line, in one of the most conservative, pro-Trump states in the country, that has often appeared to have a special place in the President's heart.

Trump supporters will now argue that Moore was a disastrous candidate, that his loss should be seen in isolation and that it has no reflection on the President's reputation or political fortunes in the months to come.

"Donald Trump tried to rescue a campaign that was doomed," said former GOP Sen. Rick Santorum, who is now a CNN commentator.

In the aftermath of that defeat, political observers will watch to see whether the President will be more willing to take advice of establishment leaders trying to cling to their Republican majorities next year or whether he will still be tempted to unleash the dogs of internal GOP civil war.

Senate Majority Leader Mitch McConnell may be reviled by Trump's supporters, but Tuesday's loss vindicated comments he made by the President's side in the White House Rose Garden barely two months ago.

"My goal as the leader of the Republican Party in the Senate is to keep us in the majority. The way you do that is not complicated," McConnell said at the time. "You have to have nominate people who can actually win, because winners make policy and losers go home."

Republicans, seeking to repeal and replace Obamacare and pass a massive tax reform bill, already have experienced the fickle nature of Senate math as McConnell has struggled to piece together a working majority.

But there were also sighs of relief for Republicans on Tuesday.

Had Moore won, the civil war raging in the party would have invaded the Senate itself, with McConnell expected to open an ethics investigation into Moore.

If the allegations against him were found to have merit, senators would likely have been forced to eject him from the Senate while incurring the wrath of supporters of the President, who strongly backed the Alabama judge.

Now they will be spared that tough vote.

Trump has proven again and again that he is a resilient political figure with an unusually loyal political base. And if the economy is still booming next November and the stock market is still humming, Democrats may find things a lot tougher than they were in Alabama and Virginia.

But the implications of the Republican debacle in Alabama will rumble on for months to come.