J. Scott Applewhite / AP

BIRMINGHAM, Ala.—No one seems to know what moved the president to issue the tweet that shook Alabama.

Last Tuesday, President Trump took a break from his usual bluster—blasting the Fake News media; threatening North Korea with “fire and fury”—to make a different kind of statement, the likes of which he’d never made before. “Senator Luther Strange has done a great job representing the people of the Great State of Alabama,” Trump tweeted at 9:16 p.m. “He has my complete and total endorsement!”

It was the first time the president had waded into a contested Republican primary, and he had done so on behalf of the race’s most disliked candidate—an incumbent backed by the Washington establishment but unpopular in his home state, who viewed him as the beneficiary of a corrupt bargain with a governor driven from office by a sex scandal.

Republicans in Alabama were puzzled. Strange himself was surprised—he nearly drove off the road when Trump called him from the White House on Tuesday afternoon, he said. Republicans in Washington didn’t know it was coming, either; Mitch McConnell, the Senate majority leader, had previously lobbied Trump to back Strange, but had not mentioned it to him for weeks, a source close to McConnell told me.

The usual slavishly pro-Trump conservative media were enraged. Mark Levin, the conservative radio host, called Trump’s tweet “a stab in the back to every conservative in this country,” while a Huntsville talk-radio host called it “ignorant.” The normally pro-Trump quarters of Fox News and Breitbart lit up with condemnation.

Strange has been a senator for just six months, having been appointed to the position when his predecessor, Jeff Sessions, became Trump’s attorney general. Before that, Strange was the attorney general of Alabama, overseeing the ethics investigation of the governor who, after appointing him, would resign to avoid impeachment. Before that, he was a Washington lobbyist. On Tuesday, Strange faces a multi-way GOP primary to keep his seat, with the top two candidates to go to a runoff if none gets a majority of the vote. Polls have him languishing in a distant second place.

Trump’s endorsement was seen as a potential game-changer for the struggling Strange, who immediately featured it in a barrage of TV ads. It was also a major boost to McConnell, who has invested heavily in Strange’s campaign. But the day after he backed Strange, Trump turned on McConnell. In a series of tweets Wednesday and Thursday, he blasted the Senate leader for failing to repeal Obamacare—and then leaving Washington on vacation. “Mitch, get back to work!” Trump tweeted. Later Thursday, he told reporters he might consider seeking McConnell’s ouster if the Senate didn’t start getting things done.

Trump’s attack on McConnell appeared to have been prompted by some gently patronizing comments the latter had made about Trump at a Rotary meeting in Kentucky: “Our new president, of course, has not been in this line of work before,” McConnell said. “And I think he had excessive expectations about how quickly things happen in the democratic process.” But two sources close to the White House told me that Trump didn’t find out McConnell had said that until after he’d made the Alabama endorsement—and it was this that fueled his rage.

“When Trump saw McConnell insulting him, he was apoplectic, because he had just done him this big favor” with the endorsement, a strategist with ties to the White House told me. Trump perceived the McConnell comments as a double betrayal considering he’d just expended political capital—and reaped blowback from his base—on McConnell’s behalf.

In Alabama, the feud is playing out as a test of conservative voters’ loyalties in the Trump era—one of the first referendums on Trump’s ability to command his own partisans, and by extension to shape the GOP that he leads. But it’s a test complicated by the mixed messages Trump himself has sent to his supporters. Will Republicans listen to his endorsement and vote for Strange? Or will they heed his attacks on McConnell, and act to punish McConnell’s candidate as he becomes the scapegoat for Trump’s flailing prospects?

Representative Mo Brooks, a conservative congressman who’s polling in third in the primary, pronounced himself “baffled” by Trump’s position. “All of this is very paradoxical, because on the one hand, President Trump vigorously complains about Mitch McConnell not getting the job done in the United States Senate,” Brooks told me. “But on the other hand, the president endorses Mitch McConnell’s boy in this Senate race.”

I asked Brooks if he thought the president was confused. “There seems to be great inconsistency in positions and hoped-for outcomes,” he said. “I think the president made a major mistake in endorsing Luther Strange.”

Big Luther came loping into a meeting room at a Birmingham-area public library on Thursday night, panting slightly and apologizing for having kept everybody waiting. A lanky six-foot-nine, Strange’s head seems too small for his massive body, and he had a slightly panicked look on his bland, pale face. He wasn’t actually late for his turn to speak to the executive committee of the Jefferson County Republicans, but having, unlike the other candidates, arrived after the meeting began, he didn’t know that.

Each candidate had been allotted five minutes to speak, and the others had rushed to pack their time with as much red meat as possible—reciting their long political resumes, articulating their many conservative policy stances, explaining at length their claim to be the best choice. Strange didn’t do any of that.

He pointed out that he was from the area—he had, he said, been hit by a car a block from this very spot as a child. He thanked the voters and thanked his opponents. And then he recounted his momentous phone call from Trump.

The president, he said, had thanked him for his loyalty and support and offered his help in return. “I said, ‘Well, Mr. President, whatever you think is appropriate—a tweet wouldn’t be bad!’ He said, ‘You know I have 118 million Twitter followers.’ I said, ‘Yes, sir, I’m very well aware of that.’”

There were chuckles from the crowd, a few dozen, mostly elderly, well-dressed white people on folding chairs. “I can’t say anything much more than what the president himself has said,” Strange said. “The president needs somebody who will work with him, who has his back. I’m going to be working as closely as I possibly can with the president to get his agenda passed as long as I’m in the U.S. Senate.” He had, he said, spoken to Trump again today, and the president had reiterated his support.

In conclusion, Strange said he guessed his time was probably about up. Not so, said the timekeeper—he had two more minutes remaining. But the senator didn’t have anything more to say. He left the stage and headed for the door.

In the hallway, Strange said he agreed with the president’s criticism of McConnell—“I don’t know why we’re taking a vacation,” he said. “We should be working to pass the president’s agenda.” Did he think, then, that McConnell should be replaced, I asked? No, he replied—McConnell was not the problem. “We don’t have 50 conservative Republican votes, and I don’t think Mitch McConnell or anybody else can make John McCain or the two ladies that voted the other way vote against their perceived interest.”

Despite being technically the incumbent in the race, and having had millions in television advertising broadcast on his behalf by a McConnell-backed political fund, Strange is viewed favorably by just 35 percent of Alabama Republicans, while 50 percent view him unfavorably, according to a recent poll. Every Alabama political operative, observer, and voter I spoke to chalked this up to the circumstances of Strange’s appointment to the Senate.

The governor, Robert Bentley, was a dermatologist and Baptist deacon who was fairly well-liked until, halfway through his second term, he was publicly accused of carrying on an extramarital affair with an aide and using state resources to try and cover it up. Explicit audio recordings and text messages soon surfaced, and the state House of Representatives began impeachment proceedings. But Strange, the state attorney general, asked the lawmakers to put their investigation on hold so that his office could examine the matter.

A few months later, Bentley appointed Strange to the Senate. Strange denied there was any conflict of interest or quid pro quo. Two months after that, Bentley resigned, making a deal with state prosecutors that involved pleading guilty to two misdemeanors and avoiding jail time.

The other candidates have criticized Strange, calling him corrupt and unethical. Brooks told me Strange had “held over the head of our governor a criminal prosecution while seeking a personal gain from the governor, in violation of all the ethics rules that govern prosecutors.” A complaint against Strange has been filed with the Alabama Ethics Commission, but it is not scheduled to meet until after this week’s election.

But the election has not mostly focused on this issue; it has centered on who loves Trump the most. Brooks himself is currently unpopular with voters after a barrage of attack ads have accused him of being sympathetic to Nancy Pelosi and ISIS—and, most lethally, unsympathetic to Trump. During the 2016 primaries, when Brooks was campaigning for Ted Cruz, he repeatedly attacked Trump, calling him untrustworthy and “a serial adulterer.”

Private polling by the super PAC running the ads, the Senate Leadership Fund, found that accusation resonated strongly with Trump-loving Alabama Republicans. Moore has consistently polled in first place, with Strange in second and Brooks close behind him—a poll last week by the Trafalgar Group found that Brooks had been gaining on Strange until the Trump endorsement seemed to stall his momentum. And so Brooks and Moore have rushed to proclaim their fealty to Trump.

“Folks, you’re looking at the guy who has supported Donald Trump—more so, with his agenda in the United States Congress, than any other candidate in this race,” Brooks told the GOP gathering. He agreed with Trump’s repeated call to eliminate the Senate’s 60-vote rule, which, he said, would make it easier to get the president’s agenda approved.

Moore, a former chief justice of the Alabama Supreme Court, was twice removed from his post for defying federal court orders—once when he refused to remove a giant monument of the Ten Commandments from the courthouse building, and again (after voters returned him to the position) when he refused to implement the Supreme Court’s decision legalizing same-sex marriage. Folksy and genial, the 70-year-old Moore has the lacquered look of an aging televangelist.

“I support making America great again. I believe we can make America great again,” Moore told the group. The race, he said, would send a signal nationally about the future direction of the Republican Party. “Are we going to go forward?” he asked. “Or are we going to stay stagnant, as we are? If we don’t go forward, we’re going to lose our country.”

While Moore is colorful and Strange represents the establishment, Mo Brooks is probably the most interesting of the Senate contenders: a Tea Party conservative in the Ted Cruz mold, which seemed to be what Republican primary voters were looking for—until Trump came along and upended the paradigm.

The day after the candidate forum, Brooks was eating lunch with a dozen supporters at a seafood shack in Spanish Fort, on the Gulf Coast near Mobile. His campaign bus, “The Drain the Swamp Express,” was parked outside, in a rapidly accumulating puddle, as a violent summer storm lashed the coastal landscape.

Brooks picked at a basket of fried fish and French fries, dipping them methodically in ketchup with a fork, as he listened to his people’s lament. With dull brown eyes and a helmet of white hair, the 63-year-old Brooks has a stiff, dorky countenance and an abrupt style. In one of our interviews, after parrying my questions in a rapid-fire monotone, he observed flatly: “I’m sure you appreciate that I have very little in the way of diplomatic skills but a lot in the way of forthrightness and candor, which you probably enjoy.”

At one end of the table, a Brooks volunteer named Celia Waters, a retired speech pathologist in a long white dress, was expressing disgust with Strange. “A lot of people are very upset with Mitch McConnell, and it’s only going to get worse if they can’t get anything done,” she said. “Luther is his pet RINO! He leads him around on a leash!”

Brooks’s wife of 41 years, Martha, said the Trump endorsement didn’t make any sense to her. “I don’t know what was said to the president to get him to endorse Luther,” she said. “I don’t know if he knew the whole story about Luther.”

A member of the House Freedom Caucus—which, he likes to remind people, you have to be invited to join—Brooks is a rock-ribbed fiscal and social conservative. He is an anti-immigration crusader who boasts the highest rating in the House of Representatives from the immigration-restriction group NumbersUSA. Elected to represent the Huntsville area in the 2010 Tea Party wave, Brooks is in his fourth term in the House.

Huntsville is on the far northern edge of Alabama. Here in the southern reaches of the state, Brooks is not well known, Waters told me, and many Republican voters only know about him what they’ve seen in those darned television ads. She had been making phone calls on Brooks’s behalf, and this was the problem she kept running into. “When I explain everything he stands for, his policies—that’s what they’re looking for,” she said. “But the biggest concern is that they think he didn’t back president Trump. All that stuff has been taken out of context.”

After Trump won the Republican primary, Brooks fell in line behind him, even sending a campaign contribution two days after the Access Hollywood tape seemed to deal a fatal blow to his presidential run. Strange, Brooks contends, “never lifted a finger.” Now, however, Brooks finds himself caught between the Republican establishment he’s made a career of opposing, and the whims of an unpredictable president who’s simultaneously attacking the establishment and taking its side in Alabama.

Brooks may claim support for Trump, but he makes it clear that his true loyalty is to principles, not personalities.That makes him an outlier in a party whose voters have largely joined the Cult of Trump. I asked him if he thought Trump was a conservative, and he answered with a tight smile: “I don’t know.” Why, then, was he so eager to align himself with Trump now, I asked?

Brooks sighed. “We all have disagreements,” he said. “What is important if you’re an elected official is the public-policy agenda. I don’t vote for or against something because of the person behind the position, I vote based on whether I believe that it’s good for our country.”

Brooks said he liked his chances of coming in second, and thus making the runoff, on Tuesday. “The biggest challenge I’ve got to overcome is the carpet-bombing of lies by Mitch McConnell and Luther Strange,” he told me. “The swamp critters are attacking me nonstop. They have decided I’m their biggest threat. And quite frankly, I agree with them.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.