MONTGOMERY, Ala. — It's Trump versus Trumpland.

President Donald Trump's political muscles are getting a workout in a Republican runoff election in Alabama that has an awkward dynamic: He's campaigning for the establishment-backed incumbent over an upstart beloved by many of his own most ardent supporters, including his former chief strategist Steve Bannon.

Motivated by personal loyalty and a sense that the race is newly competitive, Trump heads to Huntsville, Alabama, on Friday to campaign for Sen. Luther Strange, appointed in February to temporarily fill the seat that opened up when Jeff Sessions became attorney general. The winner of next Tuesday's runoff will be the GOP candidate in a December election to serve out the rest of Sessions' term, ending in January 2021.

Get Breaking News Delivered to Your Inbox

Strange is locked in a tight race with former Alabama Chief Justice Roy Moore, a jurist known for pushing unsuccessfully for the public display of the Ten Commandments and opposing gay marriage. A super political action committee tied to Senate Majority Leader Mitch McConnell, who favors Strange, has pumped millions of dollars into the race, as Senate Republicans worry that Moore would be a disruptive figure in the chamber, or might even lose to Democrat Doug Jones.

Moore led Strange in the first round of GOP voting, but not by enough to avoid the runoff, which could stand as an early test of how much sway Trump has over his political base. Both Strange and Moore have emphasized their support for the president, who is popular in the deep red state.

Strange and Moore traded jabs at a Thursday night debate, with Strange stressing that "the president supports me" and Moore arguing that McConnell and the "elite Washington establishment" were trying to influence the race.

GOP leaders worry about what a loss by Strange would say about the president's political strength going into a midterm election year, as well as their ability to advance his agenda in Congress.

McConnell spoke with Trump recently and assured him that Strange was much more competitive than recent public polls suggested, according to a person with knowledge of the call who requested anonymity to discuss it.

Trump, who endorsed Strange last month, tweeted on Thursday: "Senator Luther Strange has gone up a lot in the polls since I endorsed him a month ago. Now a close runoff. He will be great in D.C."

Challenger Moore, running on an anti-Washington platform, has backing from former Trump chief strategist Bannon and his conservative website Breitbart News, and the Great America Alliance, an advocacy group that supports Trump.

A rally for Moore Thursday night at a historic train shed on the banks of the Alabama River featured Trump allies including former Alaska Gov. Sarah Palin and former White House official Sebastian Gorka.

Palin stressed her support for the president, while arguing that Moore was a better match for Trump's "movement."

"A vote for Judge Moore isn't a vote against the president. It is a vote for the people's agenda that elected the president," Palin told several hundred cheering supporters.

Trump's visit comes after some GOP encouragement. At the end of a White House meeting last week, he asked Sen. Bob Corker, of Tennessee, about Strange's chances and Corker said Trump needed to make the trip, said a person familiar with the conversation who was not authorized to speak publicly. Trump then got on the phone with GOP strategist Ward Baker, a Corker and McConnell ally who is working on the race for the Senate Leadership Fund, to talk through the campaign, according to a different person who also requested anonymity to disclose the private conversation.

The Washington Post first reported on Corker's involvement.

Trump allies stressed that the president was also motivated by Strange's loyalty and commitment to his agenda.

Steven Law, who runs the Senate Leadership Fund, which is on pace to spend more than $9 million to keep Strange in the Senate, said "the best booster rocket that Luther Strange could have is Donald Trump coming in in the last few days."

Trump appears to be placing other factors over ideology as he pushes to keep Strange in the Senate over a candidate more in sync with the tone of his own 2016 campaign.

In 2010 and 2012, the GOP had a few disastrous Senate primaries where extreme candidates won and then lost winnable races to Democrats in the general election. Since then, McConnell has been determined not to let it happen again — and has succeeded in every instance.

But the pro-Moore forces have shown no signs of retreat. His conservative backers include Fox News' Sean Hannity and former Arkansas Gov. Mike Huckabee. Andy Surabian, a senior adviser to Great America Alliance, stressed said the efforts for Moore were not a knock on Trump.

"We all support the president and that will never change," Surabian said. But he added: "What does a change candidate breed? It breeds a movement."

Moore has stressed that the race could send a message.

"What's happening in Alabama is being watched in the halls of Congress and the Senate," Moore said at a rally over the weekend. "They know what is happening in Alabama. Mitch McConnell knows what is happening in Alabama. They know it is going to affect the future of elections of other senators in 2018 in other states."