After keeping his distance from GOP Senate nominee Roy Moore of Alabama, President Trump is now all in.

He tweeted this endorsement Monday morning for Moore, who has been accused by at least six women of initiating sexual advances when he was in his 30s and they were in their teens:

Trump subsequently called Moore on Monday and endorsed his campaign.

The White House also announced Trump will hold an event later this week in Pensacola, Fla., just across the border from Alabama. reports that some Alabama voters said they received a robo-call from the president's daughter-in-law Lara Trump, inviting them to attend the event.

So why has Trump suddenly endorsed Moore? We can't get inside his head, but some recent political dynamics offer clues. Let's review:

Polls show Moore could win

Actually, polling in this race has been all over the place. After a mid-November Fox News Channel poll showed Democrat Doug Jones with an eight-point lead, three subsequent polls found Moore with a narrow edge in the race.

At the very least, surveys released over the weekend — just before Trump endorsed Moore — didn't show Moore behind. A Washington Post-Schar School poll found that the race is basically neck and neck, while a CBS News poll found that Moore had a six-point lead among likely voters, although that narrowed to pretty much even among all registered voters.

Trump has seemed hesitant to back a candidate who could lose after other candidates he endorsed in Alabama and Virginia lost. He's conspicuously not going to Alabama to campaign for Moore, for example. But it's possible he read these latest polls and thought Moore was regaining ground, so there was less of a political risk in endorsing him.

He's already supporting Moore

Trump's endorsement of Moore simply made official what has been clear for weeks: Trump wants Moore to win.

Even when Trump went down to Alabama to campaign for Moore's opponent, interim Sen. Luther Strange, Trump seemed to long for Moore.

“I might have made a mistake,” he said.

Then, when The Washington Post broke news of a woman saying Moore initiated sexual contact with her when she was 14 and he in his 30s, Trump was one of Moore's few defenders in Washington.

At first, through a spokeswoman, Trump said that if the allegations are true, Moore should step aside. But when Trump himself addressed the issue, he backed Moore.

“Look, he denies it,” Trump said. " … He says it didn't happen. And you know, you have to listen to him also.”

Plus, Alabama voters haven't sent a Democrat to the Senate in decades. Trump, ever aware of his public image, could be queasy about that happening while he's president.

So, from the president's perspective, it's possible that Trump thought: Why not use all my leverage to try to get Moore to win? I've basically gone all in already.

Senate Republicans may have just given Trump an opening to back Moore

Trump and the rest of Washington have been on opposite sides of whether to support Moore. Senate Republicans don't want to serve alongside him. Senate Majority Leader Mitch McConnell (R-Ky.) has said Moore should drop out of the race. When Moore refused, McConnell started looking for a write-in candidate who could beat Moore but still keep the seat Republican.

Sen. Cory Gardner (Colo.), the head of Senate Republicans' campaign arm, said if Moore does win, the Senate should try to expel him.

McConnell didn't rule out the possibility that Moore could be the first sitting senator since the Civil War to be kicked out by his colleagues.

But on Sunday, McConnell didn't bring any of that up to Moore. In an interview on CBS's “Face the Nation,” he declined to say that Moore should step aside or that he will definitely face an ethics investigation that could lead to his ouster. “It will be up to the people of Alabama to make this decision,” McConnell said. “And we will swear in whoever is elected and see where we are at that particular point.”

McConnell's staff reiterates he wasn't backtracking his stance on Moore. "The leader did not change or retract any of his previous statements," said his spokeswoman, Antonia Ferrier. But some read it (including, originally, this Fix writer) as a softening, which could have emboldened Trump to do what he has wanted to do for some time now: endorse Moore.

Tax reform

Senate Republicans passed a major tax bill Tuesday night, which means Republicans are thisclose to making good on their campaign promise — and making up for not repealing the Affordable Care Act. (Side note: This is not a done deal. They still have some major hurdles to overcome.)

All Democrats in the Senate oppose the bill.

If the winner of Alabama's special election is a Democrat, it could thwart their tax bill at the last minute. At the earliest, Alabama's newest senator could be seated by Christmas. Christmas also happens to be when McConnell wants to finish voting on a version that House and Senate Republicans agree to.

Republicans should have the votes to pass this bill even without a vote from Alabama's junior senator, but why risk it? Sure enough, Trump mentioned taxes in his endorsement of Moore on Monday morning: