President Trump distanced himself from Roy Moore early Wednesday after the Alabama Republican's loss, saying that he didn’t originally support him in the Senate race because he knew Moore would “not be able to win the General Election.”

Trump congratulated Democratic candidate Doug Jones, who won the election to fill Attorney General Jeff Sessions’ seat. It was a historic win for Jones, who is the first Democrat to be elected to the Senate from Alabama in more than a quarter century.

Hours later, Trump seemingly tried to distance himself from the losing candidate, saying he “was right!”

“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 early Wednesday morning.

The president had been relatively mum on Moore in the weeks prior to the election, as the Republican candidate was dogged by sexual misconduct allegations.

Moore’s campaign battled claims that he initiated sexual contact with teenage women decades ago, when he was an assistant district attorney in his early 30s. One of the women, Leigh Corfman, alleged Moore had sexual contact with her when she was just 14. The age of consent in Alabama is 16.

Moore has repeatedly denied the allegations.

Trump kept a certain distance from Moore, but refrained from condemning him in the same way some Senate Republicans had. By early last week, Trump moved to endorse Moore, saying that Republicans needed him to tackle the GOP legislative agenda. He made a robocall for Moore urging voters to choose him in order to advance Trump's agenda.

Trump made no secret of his strong support for Sen. Luther Strange during the GOP primary in Alabama in September, but following his loss to Moore, the president deleted his Twitter endorsements for him, and scrubbed his page of any support for Strange.

TRUMP DELETES TWEETS SUPPORTING DEFEATED LUTHER STRANGE

Trump, following Jones’ victory, tweeted his support, saying “a win is a win,” and Republicans will have another shot at the seat soon.

“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!”