President Trump holds a plastic astronaut figurine given to him by Apollo 17 astronaut and former U.S. senator Harrison Schmitt (R-N.M.). (Chip Somodevilla/Getty Images)

On Monday, White House press secretary Sarah Huckabee Sanders explained that the election of Donald Trump as president meant allegations of sexual harassment against him had been dealt with. “The people of this country, at a decisive election, supported President Trump, and we feel like these allegations have been answered through that process,” Sanders said.

If winning or losing is the standard, though, the president of the United States endorsed a candidate who Alabamians decided Tuesday might well have engaged in sexual misconduct with teenagers.

Roy Moore's loss to Democrat Doug Jones in the Alabama Senate special election brings to a close a dark chapter for the White House. Perhaps better than anything in Trump's presidency, Trumps actions in the race showed just how dangerous his own chutzpah and lack of political acumen are to his presidency.

Trump has echoed Sanders's message early and often, arguing that his 2016 win served as vindication of basically all of his controversial actions and strategies. But Trump's cocksure attitude has repeatedly run into stubborn political realities and basic facts.

Alabama was almost a perfect storm on that front. Trump's agenda has thus far stalled in the Senate, where Republicans only have two votes to spare. Losing there meant they would have only one vote to spare — further imperiling legislative success on his watch. Then you have Moore, a candidate with whom Trump shared something of an affinity given that he too has vocally denied the sexual misconduct allegations against him. Trump was confronted with a choice between the GOP political establishment, which deserted Moore after the allegations were made, and a fellow persecuted politician behind whom much of the base still stood.

Given that choice, it wasn't terribly surprising which path Trump chose, and it was made with some prodding, naturally, from former top adviser Stephen K. Bannon. But the potential downside of that decision was evident from Day One. If Moore won, Trump would have helped save a seat for Republicans and triumphed over the impotent and clueless GOP establishment yet again. But if Moore lost, Trump would have attached his brand to a man voters decided might be guilty of the sordid allegations. A loss in such a Republican state would only lend credence to those allegations.

Trump also risked backing a losing candidate in a dark-red and very pro-Trump state that served as almost a refuge for Trump during his early tenure in the White House, suggesting Trump doesn't actually influence voters to support his candidates. It would be the third straight time Trump endorsed a candidate in a contested statewide race — including Sen. Luther Strange in his primary against Moore and Ed Gillespie in the Virginia governor's race — and the third straight time that candidate had gone on to lose.

Put simply: Trump set himself up to look like a political amateur, and that's exactly what happened. If Trump truly believes that things he and Sanders have said about how his election win vindicated  everything he did, he might want to reevaluate himself and start seeking better advice.