Roy Moore supporter Willie Casey is seen on Nov. 11 in Vestavia Hills, Ala., before the Republican Senate candidate spoke at the Mid-Alabama Republican Club. (Cameron Carnes/Photo by Cameron Carnes for The )

President Trump has told associates he feels good about the way he has navigated the Alabama Senate race that has riven the Republican Party and is confident he will come out fine no matter what happens in the contest, according to friends and aides he has spoken to this week.

White House advisers have recently shown Trump polls that indicate Republican nominee Roy Moore is trending upward or winning despite allegations from women who say he pursued them or made unwanted sexual advances were they were teenagers and he was in his 30s.

And the president, by leading a charge against Moore's opponent, Democrat Doug Jones, has sought to position himself as a champion of Alabama's conservative base, unlike his last foray in Alabama when he backed the loser in the Republican primary. 

Trump has said privately that if Moore wins, he would reject any move by Republican leadership to expel him from the Senate and would welcome his support on legislation, according to a senior administration official and a friend who has spoken to him. And if Moore loses, Trump will simply distance himself and remind people that he backed the current senator, Luther Strange, in the primary, these people said.

Trump has also heard from outside advisers like Stephen K. Bannon, his former chief strategist, who have told him that his political base likes Moore and may not react well to Trump going against him. He is "nearly obsessed" about his base, one senior administration official said. 

"There are two candidates in this race, and before last week, Doug Jones was skating scot-free and scrutiny free," Kellyanne Conway, the president's counselor, said in an interview. "Now people must focus on his record and the promise that he would be a doctrinaire liberal, as the president made clear. As with Trump versus Clinton, turning that race around from a referendum on him to a referendum on her was key to victory."

The move has been welcomed by the Moore campaign and aligns with the message Moore is driving in Alabama — a relentless focus on Jones's relatively liberal positions on health care, immigration, abortion and transgender rights. Trump and the Moore campaign are sharing a strategy of making the race about Jones.

"We are done with the garbage that has been dished out by some folks, so we are focused on the issues and that is what the campaign is going to be about," said Moore campaign chairman Bill Armistead. "He is going to define who he is and what he stands for and what his opponent stands for."

White House political director Bill Stepien has circulated polls that emphasize how popular Trump is among Moore voters, along with Moore's improving position in the race. Conway has told Trump that the people who want Moore out of the race also wanted him out of the race, White House officials say.

As a result, Trump has grown convinced that Senate Majority Leader Mitch McConnell (R-Ky.) and others have overplayed their hands in repudiating Moore, according to several people who have spoken with him. White House advisers laugh privately at what one aide calls McConnell's "Kabuki dance moves" to get Moore off the ballot, noting that congressional Republicans couldn't even repeal the Affordable Care Act.

Trump has also told advisers that he doesn't want to be viewed by Moore as part of the Republican establishment that the former Alabama Supreme Court judge constantly rails against.

Many Republicans have cast the issue as a moral one, saying Moore's conduct is reprehensible and that sexual misconduct is more important than a seat. Trump has not seemed as concerned, instead focusing on whether Moore can win.

Trump is also concerned that fewer Republicans in the Senate could bring headlines that say, "Oh, Trump can't get anything done," in the words of one adviser. McConnell allies scoff at the idea that Trump cares about having a GOP majority, noting that he has campaigned against Republicans and didn't take an opportunity to appoint a Democratic senator to a Cabinet spot.

The president's current position runs counter to a decision he made two weeks ago during his trip to Asia to sign off on the Republican National Committee's decision to cut ties with Moore — a move that hobbled the candidate's get-out-the-vote and data operations. Trump has no personal loyalty to Moore and has even criticized him behind his back, according to one person who spoke to the president. A trip was determined by the president's aides to be too risky, several said, and Trump didn't relish returning to Alabama, where he regrets the Strange endorsement.

But after returning from Asia, Trump's position began to shift. "He wants to keep his current calculation," one person who spoke to Trump said. "Of being helpful, but not over the line. Of being helpful, but not being out there praising Roy Moore. Of trying to help Moore win, but not being down there in Alabama." 

Inside the White House, the initial calculation were that the accusations first published by The Washington Post could crush Moore's candidacy and that Trump didn't want to be associated with a loser. But now, as "every day goes on, it gets further and further away from the accusations," one official said, "and the polls improve." 

The White House has also relished the media attention on Sen. Al Franken (D-Minn.) and others accused of sexual misconduct. One outside adviser compared the situation to Trump's rebound during the campaign from the "Access Hollywood" videotape, where Trump could be heard bragging about assaulting women. One senior White House aide said new accusations also made it easier for Moore's campaign to question the accusers.

"It's like this overwrought reaction, where everybody is telling voters this is all you should care about," one senior official said. "Trump keeps busy telling voters about other things, too."

Two people who have spoken to Trump say he is less concerned about veracity of the accusations against Moore than how they will affect the candidate's standing in the race. Several aides and advisers to Trump said the current strategy was to continue criticizing Jones while not committing to doing anything for Moore.

Josh Holmes, a former top adviser to McConnell who has been critical of Moore, said Republicans in Washington are resigned to letting the race play out.

"Everybody in D.C. is done. Period," said Holmes. "There are no more conversations happening about Alabama in D.C. There is nothing anyone in D.C. can do about it." 

The Moore campaign has been trying to raise money off the president's newfound support. An email sent Wednesday from Moore to readers of Breitbart, the conservative website run by Bannon, carried the subject line, "President Trump punches back at my opponent." 

Locally, Trump's comments have had less impact and Moore did not mention them at his last campaign rally on Monday. Jon Gray, a Republican consultant who has been polling the race for local television networks, said he saw no indication that Trump's recent comments were swaying state voters.

"They are done, they don't want to hear anything and they are not going to change their vote," Gray said. "They care more about the direction of the country than trying to determine whether or not the accusers are telling the truth." 

Moore has denied any sexual misconduct and his advisers have tried to discredit several of his accusers. Moore has also said he knew at least two of the accusers at the time and may have dated teenagers while in his 30s but that he does not remember any specific instance.