Image copyright Reuters

A Republican Senate primary in Alabama is twisting Donald Trump and his party in knots and turning the president's supporters against each other.

Mr Trump has put his power and reputation on the line for the kind of Washington insider he used to rail against - a former corporate lobbyist who was appointed to the Senate by a governor who subsequently resigned in disgrace, no less.

Meanwhile erstwhile White House aides, rabble-rousing former Trump surrogates and even a member of the president's own Cabinet are lining up behind an upstart insurgent who almost no one in Washington wants to see roaming the halls of the Senate.

The senator and the judge

The president's man is Luther Strange, the former Alabama attorney general named to the seat Jeff Sessions vacated when he became US attorney general earlier this year.

Despite his Dickensian name and remarkably tall stature (6 feet, 9 inches), Mr Strange is an otherwise unremarkable politician, reserved in manner and unenthusiastic on the stump - a replacement-level senator from a reliably conservative state.

For an incumbent with his party's support, that's usually good enough to ensure a smooth nomination. Not this time, however.

Image copyright Getty Images Image caption Luther Strange has relentlessly touted that he has Donald Trump's endorsement

With just a day left before a run-off vote for the Republican nomination, Mr Strange trails in opinion polls to Roy Moore, a man who has been called many things, but unremarkable and unenthusiastic are not among them.

The former Alabama chief justice and tireless evangelical firebrand once lost his job on the state's Supreme Court because he refused to obey a federal order to remove a massive sculpture of the biblical Ten Commandments from his courthouse.

He was elected by the people of Alabama to the court again, then was suspended - and subsequently resigned - for failing to enforce the US Supreme Court's 2015 ruling legalising gay marriage.

Mr Moore is a lawyer who says the laws of man are superseded by those of God; a politician campaigning to make life miserable for politicians in Washington.

Judge Moore and Senator Strange, a political odd couple if there ever were one, held an unusual, unmoderated hour-long debate in the state capital of Montgomery on Thursday night, and within minutes the gist of their campaigns was clear.

Media playback is unsupported on your device Media caption Roy Moore: 'Sexual perversion and sodomy sweep this land'

Mr Strange found a way every five minutes to note he had the backing of Mr Trump - who packed tens of thousands of supporters into a southern Alabama football stadium in August 2015. The senator positioned himself as the experienced hand who could help enact Mr Trump's agenda.

Mr Moore, on the other hand, was all fire and brimstone. He opened with a warning about the threat of "transgender troops in our bathrooms" - and went on from there.

"I want to see virtue and morality return to our country," he said. "Crime, corruption, immorality, abortion, sodomy, sexual perversion sweep our land."

When Mr Moore did talk about Mr Trump, it was to suggest that the president was being misled into supporting a man who was a rubber stamp for the hated powers in Washington.

A president 'sabotaged'

This is the conundrum at the heart of the Alabama special election.

Why is Mr Trump fighting on the side of the Washington establishment?

Why, in particular, is he making league with Senate Majority Leader Mitch McConnell, who the president - and many Alabama conservatives - hold most responsible for legislative failings in Congress this year?

The question perplexed Mr Moore's supporters at a post-debate rally just a handful of blocks away from Thursday night's debate site in Montgomery.

As a sign held up by Mobile resident Chu Green put it: "Mr President and Mr VP I love you, but you are WRONG! America needs Judge Moore."

"Judge and Trump, to me, are hand in hand," said Boyd Wainwright, a registered nurse from nearby Prattville. "It's a no-brainer."

Janet Oglesby, a retiree from Mobile, said the president is an "honourable" man who is being sabotaged by the members of his own party and even his own administration who are telling him to support Mr Strange.

Image caption Janet Oglesby and her husband Omer think Donald Trump is being misled into supporting Luther Strange

"I think that someone gave him advice that they knew would hurt him," she says.

The crowd's angst gave way to joy upon arrival of Mr Moore's campaign bus, carrying an assortment of political celebrities from the fringes of power.

Siran Stacy, a former star running back for the Alabama Crimson Tide college football team, lashed out at the hundreds of thousands of dollars Mr McConnell and Washington-based groups have poured into Alabama to support the Strange campaign.

"We're not going to allow any outside influences to tell us who we ought to see in the Senate," he said. "We don't mind you coming to our house. You can come down, and we can fix you some grits and scramble some eggs, but don't tell us how to run our house."

Former White House aide Sebastian Gorka - introduced as the "rock star" behind the president's best speeches - cast Mr Moore as the true keeper of Mr Trump's anti-establishment flame.

"Let's remember what we all did in November," he said. "We elected a man who I worked for, who had never ever held political office or senior military rank. Why? Because the political establishment on the left and the right have betrayed us for too long."

And finally, former Alaska Governor Sarah Palin drove the point home, accusing the establishment of trying to "hijack" the Trump presidency.

"On Tuesday, you get to tell them, 'Hey, our movement isn't over, and it's not slowing down," she said.

Image copyright Reuters

Several days later Moore would host another rally, with Duck Dynasty's Phil Robertson, recently ousted Trump senior adviser Steve Bannon and former UK Independence Party leader Nigel Farage.

As Mr Strange quipped during their debate, Mr Moore's advocates look like "the unemployment line at the White House".

Then again, they also look a lot like the vanguard of Trump's political revolution. A Moore rally - its enthusiastic crowds, its homemade signs, its unscripted political edginess - looks a lot like a small-scale Trump event.

The Trump bump

Of course, if Mr Moore's campaign get-togethers seemed like ersatz Trump circa 2016, on Friday night Mr Strange had the real thing - a packed, 10,000 seat arena of adoring, Make America Great Again hat-wearing supporters there to hear the president's in-person pitch for the senator. Sort of.

In a speech that lasted nearly an hour and a half, the president said Mr Strange "works hard" and "shares our agenda".

He said he's backing the senator because, unlike some other politicians, he never asked for anything in exchange for his support.

In true Trump fashion, however, the praise was sometimes backhanded. He noted - as he had in earlier tweets - that Mr Strange had been trailing badly in the polls and only "pulled even" after the president's endorsement.

And, perhaps most concerning for the embattled senator, he said that if Mr Moore wins, he'd come back to Alabama and campaign "like hell" for him.

Image caption Peter Grove decorates an old bicycle with anti-Strange, pro-Moore signs

That line will be welcome news to the pro-Moore supporters, including those who had gathered outside the Huntsville venue to show support for their man.

Peter Grove, a retiree from Cloverdale, said he didn't think Mr Trump cared whether Mr Moore or Mr Strange won - he was just endorsing the incumbent (whom he called "Lucifer Strange") to collect some political capital.

Eva Dastrow, a recent high-school graduate now working at a Christian ministry, said many in the Trump crowd were telling her they were pro-Moore and just there to see the president.

Image caption Eva Dastrow has travelled across Alabama to campaign for "godly" Roy Moore

"Moore has proven to Alabama and the nation that he'll stand on God's word," she said.

After the rally, the verdict was mixed. Kenny Minyar said he was on the fence, but Mr Strange's loyalty to the president won him over. Melissa Hotz, on the other hand, said she came into the evening "all for Moore". Did the president change her mind?

She shook her head and smiled.

According to a Cygnal Political poll released on Monday, 31% of Alabamans were more likely to vote for Mr Strange based on the president's endorsement, while 30% were less likely. Overall, Mr Moore led the senator 52% to 41%.

Holding his nose and voting

If there's any hope for Mr Strange it won't come from opinion surveys, which paint an increasingly dark picture. Or from the sometimes conflicted thousands who flocked to the arena in Huntsville, Alabama, to hear the president speak. Or from the millions of dollars in anti-Moore advertising that have saturated the Alabama airwaves for months.

The senator's fate, rather, could be decided by the kind of folks having lunch in Charlie's Place, in Selma, Alabama, on Friday afternoon.

Just a block from the Edmund Pettis Bridge, where a violent clash between police and anti-segregation protesters became a rallying cry for the 1960s civil rights movement, diners munched on burgers and fried green tomatoes and largely avoided discussing state politics, which owner Charlie Morgan called "a mess".

Image caption Cullen Wiggens (left), Emily Rogers and friends talk Alabama politics over lunch

When pressed, most of the customers said they were reluctantly going to vote for Mr Strange.

"I'm going to hold my nose and do it," said James McNeill, a lawyer who went to school with Mr Moore and wants nothing to do with him.

Cullen Wiggins, a chemical company sales executive, said he was also going to opt for Mr Strange - but would cast a ballot for Democrat Doug Jones in December. He said Mr Strange is corrupt but "Moore is crazy".

And that's how Mr Strange might win. Mr Moore has enthusiasm on his side but if enough Alabama Republicans object to his extreme evangelical politics, they could opt for the more traditional pick.

The key will be getting those less-than-inspired Alabama Republicans to the polls. That's where an organised get-out-the-vote effort comes in - something the Strange campaign has more than enough funds to pull off.

Even the best outreach programmes can only do so much to inspire lethargic voters, however.

Emily Rogers said she had received a robo-call from presidential daughter-in-law Lara Trump - but it did nothing to convince her to head to the polls for Mr Strange. In fact, she admitted, she still didn't even know when the vote takes place.

Signs of a coming storm

On Friday night, Mr Trump expressed his doubts about whether he was doing the right thing by coming down to Alabama to push for Mr Strange.

He said he "might have made a mistake" and fretted that if Mr Strange were to lose on Tuesday, the media would say the president had failed to "pull his candidate across the line".

Image copyright Getty Images Image caption Donald Trump has embraced Luther Strange - but will it be enough?

If the president is a bit concerned, however, others in Washington are downright scared.

Mr Moore's success raises the possibility that while Republican Party loyalists have sought a means to work with the president, the forces that swept him to power could be beyond even Mr Trump's control.

If an upstart judge can take down a sitting senator with a wealth of resources at his disposal, is anyone in the establishment safe?

If Trump's stardom can't pump voltage into Mr Strange's campaign, what will protect Republican members of Congress from a bloodbath in next year's mid-term elections?

For some, the possibility that the recent conservative populist revolt is a storm that has not yet been spent is their greatest fear.

For those on the outside, however - the ones who are rallying around an upstart judge in the heart of Dixie - a bigger, stronger tempest to come is their dearest wish.

And the sooner the president returns to the fold, the better.