HUNTSVILLE, Ala. — President Trump on Friday implored Alabama voters to support Senator Luther Strange in a close Republican primary, putting his personal political clout on the line in a break with his anti-establishment supporters to aid a lawmaker he portrayed as a loyal soldier for his agenda.
At a raucous rally that he admitted he would rather not have had to attend, Mr. Trump offered a rambling tribute to Mr. Strange, arguing that he had been unfairly tagged as an establishment lackey and an ally of Senator Mitch McConnell of Kentucky, the majority leader whose allies have bankrolled much of Mr. Strange’s campaign.
“They say he’s friendly with Mitch — he doesn’t even know Mitch McConnell,” Mr. Trump told a roaring crowd of several thousand at the Von Braun Center. “Luther is a tough, tough cookie. He doesn’t deal with and kowtow to anybody.”
Yet even as he offered enthusiastic praise of Mr. Strange, Mr. Trump conceded he was conflicted about having waded into the primary contest, to be held on Tuesday, which pits the senator against former state Supreme Court Justice Roy Moore, an evangelical conservative who has the backing of many of the president’s anti-establishment supporters.
“I shouldn’t be doing it — the last thing I want to do is be involved in a primary,” Mr. Trump said, adding, almost as if to himself: “I might have made a mistake.” If Mr. Strange loses, he mused aloud, adopting the dramatic tone of a television newscaster, it will be portrayed as “a total embarrassment” for him.
“I’m taking a big risk, because if Luther doesn’t make it, they’re going to go after me,” the president said of the news media.
Mr. Trump assured the crowd that should that happen, he would intensively back Mr. Strange’s rival, drawing an ovation from the arena’s capacity crowd even as he essentially undercut his own message days before voters go to the polls.
“If his opponent wins, I’m going to be here campaigning like hell for him,” Mr. Trump said, although he added that Mr. Moore “has a very good chance of not winning” in the general election against a Democrat.
Mr. Trump inserted himself into the Alabama race last month, taking many Republicans by surprise with a posting on Twitter that said Mr. Strange had his “complete and total endorsement.” But then Mr. Trump was quiet on the matter for weeks, calling into question his willingness to throw the full weight of the presidential bully pulpit behind the Alabama senator.
Mr. Trump’s decision to back Mr. Strange in the first place ran counter to the advice of some of the president’s advisers, who had privately argued that Mr. Trump should not expend precious political capital in support of a candidate who could lose. More recently, Stephen K. Bannon, his former chief strategist, has publicly urged Mr. Trump to abandon Mr. Strange, portraying him as a lieutenant of Mr. McConnell and the personification of the “swamp” of establishment Washington that the president has condemned.
Only hours before Mr. Trump was to appear in Huntsville, his own secretary of Housing and Urban Development, Ben Carson, issued a statement praising Mr. Moore as “someone who reflects the Judeo-Christian values that were so important to the establishment of our country.” It underscored the degree to which Mr. Trump’s endorsement of Mr. Strange has driven a wedge between the president and his core supporters, who flocked to his anti-establishment message and many of whom are backing Mr. Moore.
Yet Mr. Trump, appearing at ease in campaign mode after a week of scripted speeches and diplomatic maneuvering at the United Nations General Assembly, thrilled Alabamians with tough talk about national security and immigration, and dismissing as a “hoax” the notion that Russia meddled in the 2016 election despite the unanimous consensus of the nation’s intelligence officials.
He indulged himself on several pet topics that were of no apparent help to Mr. Strange, including the president’s Electoral College success, his decision to work with congressional Democrats and what he argued was the growing penchant of N.F.L. referees to throw flags for hard hits.
The digressions were part of a meandering, more than hourlong speech, interspersed with scripted praise for Mr. Strange and extemporaneous declarations of wonder about the sheer size of the 6-foot-9 senator known as Big Luther.
“That is the tallest human being I’ve ever seen,” Mr. Trump said at one point.
“Luther wants to end business as usual, stop the insider dealing, and Luther is determined to drain that swamp,” Mr. Trump said. “Luther has proved that he’s not beholden to anyone.”
Mr. Trump said Mr. Strange was the only Republican senator who did not solicit a personal favor from him when the president was working the phones earlier this year trying to persuade lawmakers to support a plan to repeal the Affordable Care Act. Lapsing into a Southern accent to imitate various Republican senators he said had begged him to visit with their families or dine with their wives as he lobbied for their votes, the president said Mr. Strange had demanded nothing, saying simply: “If you want my vote, you have it.”
“I went home and told my wife that’s the coolest thing that’s happened to me in six months,” Mr. Trump said. “We have to be loyal in life.”
Mr. Strange was plainly elated to have the president make a long-anticipated campaign appearance on his behalf — he clapped joyfully as Air Force One touched down in Huntsville as the sun set. Many in the rally crowd were clearly here to see Mr. Trump as well, and either cared little about Mr. Strange’s candidacy.
Seemingly worried about turnout, supporters of Mr. Strange sent three emails on Thursday to Alabama Republicans urging them to come to the rally — one to Mr. Strange’s list, another to Mr. Trump’s list of Alabama backers and another from the state’s most powerful business lobby.
And Mr. Strange, in a debate on Thursday with Mr. Moore, repeatedly promoted the rally, at one point even suggesting 20,000 people could show up.
Mr. Trump’s decision to line up with Mr. Strange has thrilled business-aligned Republicans in Alabama and in Washington, offering a sheen to mask any scent of the senator’s past as a lobbyist in the nation’s capital for much of the 1980s.
“We have worked together to fight the establishment,” Mr. Strange told the crowd of himself and the president, calling Mr. Trump “my friend” and wearing his signature “Make America Great Again” hat. He said the race’s outcome “will determine whether the president has the votes he needs in the Senate to stand up to Mitch McConnell, John McCain.”
“He knows I’ve got his back,” Mr. Strange said of the president.
Mr. Moore’s anti-establishment backers argue that the president is being hoodwinked, and that a victory by Mr. Strange would amount to a rejection of Trumpism.
“Guys, the swamp, it’s trying to hijack this presidency,” former Gov. Sarah Palin of Alaska told Moore supporters at a rally in Montgomery, the state capital, on Thursday night. “The swamp is trying to steal the victory that we worked so long and hard for.”
The bitterness even came through in the invocation at the Thursday gathering, when state Supreme Court Justice Tom Parker used the prayer to scorn Mr. Strange for hiding “behind the skirts of others.”
The president is beloved by Alabama conservatives — polls show his approval ratings well into the 80 percent among the state’s Republicans — but his decision to aggressively intervene in the race only four days before the runoff has perplexed some of his admirers. Some of the most hard-line Republicans who are backing Mr. Moore are also the same voters who flocked to the president’s candidacy last year.
“His supporters are Moore people, it’s overlapping,” said Steve Flowers, a former Alabama Republican legislator-turned-political columnist. “And they’re not going to change because Trump asked them to. They’ve known Moore a long time.”