President Donald Trump arrives at Joint Base Andrews in Maryland, U.S., upon his return to Washington from New York, December 2, 2017.

President Donald Trump formally endorsed Alabama Senate candidate Roy Moore on Monday, following a phone call between the two men.

"The President had a positive call with Judge Roy Moore during which they discussed the state of the Alabama Senate race and the President endorsed Judge Moore's campaign," said White House principal deputy press secretary Raj Shah.

The endorsement came despite nearly a half-dozen, decades-old sexual misconduct claims against Moore by women who were teens at the time. Until now, Trump had avoided issuing a full endorsement of Moore, choosing instead to attack Moore's opponent, Democrat Doug Jones.

Moore's campaign announced the presidential endorsement in a tweet, saying Trump "offered his full support and said he needs a fighter to help him in the US Senate."

Moore Tweet

The endorsement could put the president at odds with some of the most senior members of his party, including Senate Majority Leader Mitch McConnell, R-Ky., who previously called on Moore to drop out of the Dec. 12 special election.

In recent weeks, however, both GOP senators and the White House have tempered their initial criticisms of Moore, paving the way for Trump's endorsement.

Trump's turnabout on Moore initially took the form of increasingly sharp attacks on Jones, but slowly shifted from anti-Jones to pro-Moore. A few days before Thanksgiving, Trump repeated Moore's denials when reporters asked him about the allegations. "He totally denies it. … He says it didn't happen, and you have to listen to him, also," Trump said.

At least five women have alleged that Moore pursued unwanted sexual relationships with them when they were teenagers and Moore was in his 30s. Two of them alleged that Moore sexually assaulted them when they were minors. Moore has denied any allegation of sexual misconduct, but said he could not recall if he dated teenagers when he was in his 30s.

Following the initial spate of allegations, McConnell told reporters in Kentucky last month that he believed Moore's accusers, and that Moore "should step aside." The leader of the Senate Republicans' campaign arm, Sen. Cory Gardner, R-Colo., went a step further, saying that if Moore were to be elected, his fellow senators should vote to expel him from the Senate.

Moore has vehemently refused to drop out of the race, however, and his campaign has portrayed the allegations as part of a conspiracy orchestrated by Democrats and Senate Republicans, designed to keep the controversial former judge out of the Senate.

The allegations were reported by multiple news outlets, including The Washington Post and AL.com, and were backed up by the women's relatives and friends. Recent polls show Moore and Jones locked in an extremely tight race in Republican-controlled Alabama — evidence of how much the allegations have damaged what was once viewed as an easy victory.

Trump and the White House hope his endorsement, as well as a planned Trump campaign rally in a neighboring area of Florida, will help to rally Trump's base to turn out and vote for the Republican candidate. Should Moore win, he would help to protect the GOP's razor-thin majority in the Senate.

Still, it's unclear what Trump or the Republican Party would gain in the long run by helping to elect Moore. Republican senators have promised to launch an immediate ethics investigation into Moore's conduct if he is elected, which would keep the allegations against Moore in the news for months. Democrats, meanwhile, would relish the opportunity to tie Republican candidates to Moore and his alleged misconduct in the 2018 midterm elections.