The day President Donald Trump called on Montana Sen. Jon Tester to resign, the senator was working on his farm in Big Sandy. It’s the same farm where his grandfather settled in 1912 and the same farm where Tester lost three fingers on his left hand to a meat grinder in 1965.

It was April 28, a few days after Tester, the ranking Democrat on the Senate Veterans’ Affairs Committee, had played a major role in defeating the nomination of Ronny Jackson, Trump’s pick to run the Department of Veterans Affairs.

“The Secret Service is unable to confirm (in fact they deny) any of the phony Democrat charges which have absolutely devastated the wonderful Jackson family,” Trump wrote just after 7 a.m. on a Saturday. “Tester should resign.”

Allegations made by Senator Jon Tester against Admiral/Doctor Ron Jackson are proving false. The Secret Service is unable to confirm (in fact they deny) any of the phony Democrat charges which have absolutely devastated the wonderful Jackson family. Tester should resign. The..... — Donald J. Trump (@realDonaldTrump) April 28, 2018

Tester’s bid for a third term was never going to be easy: Democrats can’t win easily in Montana, a largely rural, 88 percent white state that Trump won by 20 percentage points two years ago. And while Tester had won statewide twice, he did so both times with under 50 percent of the vote.

The consensus was that his re-election bid got a lot more difficult after Trump’s tweetstorm. Trump had become friends with Jackson, who had served as the president’s government-supplied doctor, and took umbrage at Jackson’s downfall over allegations of drinking on duty and creating a hostile work environment.

The president made clear that taking out Tester was now personal. And yet Tester survived, even though he voted against both of Trump’s Supreme Court nominees and assembled the most liberal voting record of the five Democratic senators facing re-election in deep red states in 2018. He and West Virginia’s Joe Manchin were the only two Democratic senators to triumph in states Trump won by more than 10 points in 2016, while Missouri’s Claire McCaskill, Indiana’s Joe Donnelly and North Dakota’s Heidi Heitkamp lost.

Tester’s win provides a blueprint, if not an easily replicable one, for how Democrats can win in red states without running to the center: Build a brand, stick to kitchen-table issues and hope for some luck and GOP missteps.

Trump Attacks Fall Flat

Inside Tester’s campaign, the reaction to Trump’s newfound interest in the race was very different. Staffers believed that Tester had built a unique and uniquely Montanan personal brand that would enable him to survive Trump’s assault and that the senator could use a relentless focus on health care to slam a flawed opponent.

His eventual victory — he cracked 50 percent of a statewide vote for the first time — relied on that personal brand, as well as supercharged turnout from the state’s Native American population.

“You can’t overreact to big, flashpoint moments. We tried to steady the ship,” Christie Roberts, Tester’s campaign manager, said in an interview. “The president’s calling on him to resign, and he’s just back on the farm doing work.”

They had good reason to ignore Trump’s assaults: They wouldn’t work. The same week as Trump’s call for Tester to resign, Senate Majority PAC, a super PAC controlled by allies of Senate Minority Leader Chuck Schumer (N.Y.), found 42 percent of Montana voters polled said they supported Tester’s handling of Jackson’s nomination, while 37 percent disapproved.

The group’s pollster also tested out a potential attack line: “In Montana, we value integrity and support our president. But Jon Tester spread false information about a respected Navy admiral, helping D.C. Democrats derail Trump’s Veterans Affairs nominee. Jon Tester’s been part of the D.C. swamp for far too long. He’s betrayed our trust, our veterans, and our president. Jon Tester: Disgraceful. Dishonest. And that’s why it’s time for him to go.”

Just 32 percent of voters said the attack gave them “major doubts” about Tester, while 46 percent said they had “no real doubts.”

At the same time, Tester was running ads about how many bills he wrote that Trump signed into law — showing he was willing to work with the president, even as Trump bashed him.

Running Against An Insurance Commissioner With A Baltimore Accent

Tester’s bid for a third term started with a dash of luck — or maybe political chicanery. During his transition, Trump selected Montana’s Rep. Ryan Zinke, a former Navy SEAL who had been widely expected to challenge Tester, as interior secretary. Senate Republican operatives screamed, noting that a public lands activist who once ran a pro-Tester super PAC had encouraged Donald Trump Jr. to weigh in on Zinke’s behalf.

Then Greg Gianforte, the Republican candidate to fill Zinke’s seat, permanently damaged his political reputation by body-slamming a journalist on the eve of the special election. While Gianforte still won that House race, it appeared less likely that he would run for governor in 2020. GOP operatives said they believe Tim Fox, the state’s attorney general, passed on a Senate run against Tester because a possible gubernatorial bid was now easier.

Matt Rosendale, a more hard-line conservative than Fox or Zinke, posed a different challenge for Tester. With the endorsements of Sens. Rand Paul (Ky.) and Ted Cruz (Texas), it was less likely Rosendale would lose significant votes to a Libertarian candidate — as Republicans did in 2006 and 2012 against Tester — but it might be more difficult for him to reach the middle.

Rosendale had two major vulnerabilities: He was an outsider, born in Maryland and equipped with a noticeable Baltimore accent. And he oversaw the state’s insurance markets, making him vulnerable on the very issue Democrats everywhere hoped to exploit: health care.

Rosendale technically had two job titles ― auditor and insurance commissioner. When the Tester campaign polled his favorability using the first title, he typically finished in positive territory. When they repeated a poll with the second title, his favorability plummeted, often to 10 points underwater.

“Rosendale being a carpetbagger made people not trust him,” Roberts said. “Rosendale being insurance commissioner made people not vote for him.”

With the help of his health care focus ― along with a healthy dose of messaging on protecting public lands and assisting veterans ― Tester was able to win about 10 percent of voters who backed Donald Trump in 2016 and 10 percent of those who approved of Trump’s job performance two years later.

GOP Skittishness

Winning over a healthy number of swing voters in Montana wasn’t enough for victory; Tester’s campaign also needed to spike turnout by the state’s liberal base, primarily in the college towns of Missoula and Bozeman and among the state’s Native American population. (Montana’s population is about 6 percent Native American.)

Tester’s campaign hired 18 organizers across the state’s seven reservations and opened a field office in Wolf Point, on the Fort Peck Reservation ― the first campaign office for a statewide campaign on a reservation since Barack Obama’s attempt to win the state in 2008. They talked to 7,500 reservation residents and registered more than 1,000 voters. The result? Montana’s reservations were among the few places in America where turnout in 2018 topped 2016 turnout. On Rocky Boy’s Indian Reservation, turnout was 120 percent of the 2016 level.

While the Tester campaign was pushing its message ― the campaign put out its first television ads in March and never went off the air ― Republicans seemed unsure of whether to invest. GOP groups repeatedly released internal polls, hoping to persuade the party to invest in television ads attacking Tester ― and they eventually did.

But some Rosendale allies insist the help came too late.

“Had people invested earlier, we would’ve won,” said David McIntosh, the president of the Club for Growth, which spent heavily on Rosendale’s behalf in the primary and general elections.

McIntosh and other Republicans pointed to another major blow: A judge’s decision in July to knock a Green Party candidate off the ballot. The GOP had hoped a Green Party candidate would siphon votes from Tester.

The Green Party’s “vote would be equal to the Libertarian, and that would’ve won the race for Rosendale,” McIntosh said, suggesting the decision to knock the Green Party candidate off the ballot was politically motivated. “The people of Montana ought to recall those judges, because they just became politicians.”

Even as Republican groups debated whether to spend on the contest, Trump’s dedication to ousting Tester was never in doubt. He visited the state four times to campaign for Rosendale, and Donald Trump Jr. joined Rosendale for a multiday campaign sprint. (Trump Jr. called Tester a “piece of garbage.”)

But the visits weren’t changing much and were firing up the Democratic base as much as they were encouraging the GOP’s core followers.

“The president coming had diminished returns,” Roberts said. “His last visit to Bozeman, you couldn’t even get into our office in Bozeman. He activated our base too.”