President Trump’s private warning that 2018 could be a “bloodbath” if Republicans don’t make good on his promise to repeal the Affordable Care Act may sound like hyperbole, but Republicans thinking of crossing him shouldn’t laugh it off. Just ask Rep. Martha Roby.

A year ago, Roby was viewed as a rising star in Alabama Republican politics. Elected to Congress in 2010 at the age of 34, the former Montgomery City Councilwoman quickly impressed her GOP colleagues, who chose her for a coveted slot on the House Appropriations Committee. In 2014, she won re-election with 67 percent of the vote, and in March 2016, she crushed primary challenger Becky Gerritson, founder of the Wetumpka TEA Party, with 66 percent.

But last October, after the release of the infamous Access Hollywood tape, Roby withdrew her presidential endorsement: “Donald Trump’s behavior makes him unacceptable as a candidate for president, and I won’t vote for him,” she declared.

The backlash was swift. A week after Roby issued her statement, she was uninvited from speaking to a meeting of the Pike County Republican Women. Trump loyalists in Alabama’s 2nd congressional district drafted Gerritson for a last-minute write-in campaign. On election night, while Trump was carrying the 2nd district with 65 percent of the vote, Roby won with just 49 percent. A little-known Democrat took 41 percent, while write-in votes — almost all for Gerritson — accounted for 11 percent.

As Republicans in Congress wrestle with a number of thorny topics — including the Trump administration’s directives to “repeal and replace” the ACA and build a border wall, plus calls for an investigation into possible Russian interference in the election — both the White House and the 2018 midterm elections are casting long shadows over their decision-making processes. And a deeper dive into last year’s election data suggests there could be more risk than reward in bucking Trump (as long as Trump’s voters support his agenda, which isn’t guaranteed), and that the penalty may come not just in GOP primaries, but also in general elections.

Sure, there were plenty of Republicans who never embraced Trump and who thrived anyway: GOP Reps. David Valadao (in California’s 21st district), Carlos Curbelo (Florida’s 26th) and Charlie Dent (Pennsylvania’s 15th) cast off Trump from the outset, never made news by switching their positions, and won their races handily.

But abandoning Trump mid-campaign — a strategy Speaker Paul Ryan seemed to adopt, possibly in an effort to preserve a Republican majority in the House — probably cost Republicans at least one Senate seat.

To reach this conclusion, I examined local-level results in five of 2016’s most competitive Senate races: Illinois, New Hampshire, North Carolina, Pennsylvania and Wisconsin. Four of these five were also presidential battleground states (the exception is Illinois) — and their incumbent Republican senators took several different routes when it came to Trump, giving us a nice sample with which to make comparisons.

GOP Sens. Mark Kirk of Illinois and Kelly Ayotte of New Hampshire very publicly revoked their support for the GOP nominee — in Kirk’s case, after Trump’s attacks on Judge Gonzalo Curiel became big news in June, and in Ayotte’s case, after the Access Hollywood tape was made public in October. On the other hand, GOP Sens. Richard Burr of North Carolina and Ron Johnson of Wisconsin never retracted their endorsements, and Sen. Pat Toomey of Pennsylvania refused to take a position on Trump until an hour before his state’s polls closed.

In each state, I compared the presidential and Senate results in two sets of counties (or towns, in the case of New Hampshire): One was “Trump Zones,” which were defined as the places where Trump won a higher share of the two-party vote than Mitt Romney did in 2012, and the other was “Non-Trump Zones,” which were places where he won a lower share than Romney.

Both Kirk and Ayotte presumably hoped that after their high-profile defections, they would hold onto enough voters in Non-Trump Zones to win re-election in Democratic-leaning states. But in the end, the number of Trump Zone voters they lost neatly offset the number of Non-Trump Zone voters they gained. Neither of them ran appreciably ahead of Trump, and both lost.

Kirk, for example, ran slightly ahead of Trump in the northern Chicago suburbs, but he also lost the former coal mining haven of Gallatin County in Downstate Illinois, where Trump carried a whopping 72 percent of the total vote. And Ayotte ran slightly ahead of Trump in the tony Manchester suburb of Bedford — home to New Hampshire’s newest Whole Foods Market — but she lost the old paper mill town of Northumberland, where Trump beat Clinton by 15 percentage points.

However, Burr and Johnson not only ran slightly ahead of Trump in Non-Trump Zones like the Charlotte and Milwaukee suburbs; they also held onto nearly all of Trump’s voters in Trump Zones like North Carolina’s Sandhills and Wisconsin’s Iron Range. In North Carolina, where Trump prevailed by 4 points, Burr won by 6 points. In Wisconsin, where Trump won by less than 1 point, Johnson prevailed by 3 points.

By keeping his stance on Trump under wraps, Toomey took an approach somewhere in between the Kirk/Ayotte path and the Burr/Johnson one, and he got similarly in-between results in the election. The Pennsylvania senator ran far ahead of Trump in the Philadelphia suburbs and only slightly behind the top of the ticket in Trump Zones like northeastern and southwestern Pennsylvania. However, it was good enough for a win: Trump won by less than 1 point, while Toomey won by 2 points.

Two-Party Vote MARGIN STATE INCUMBENT TRUMP GOP SENATE DIFF. IL Mark Kirk +22.7 +11.4 -11.3 NH Kelly Ayotte +5.3 +2.8 -2.5 NC Richard Burr +25.5 +25.1 -0.4 PA Pat Toomey +8.0 +6.3 -1.7 WI Ron Johnson +14.3 +14.1 -0.2 In counties where Trump outperformed Romney … Calculations made using two-party vote shares Based on election returns from official sources

TWO-PARTY VOTE MARGIN STATE INCUMBENT TRUMP GOP SENATE DIFF. IL Mark Kirk -37.4 -28.9 +8.5 NH Kelly Ayotte -15.0 -7.4 +7.6 NC Richard Burr -22.8 -17.1 +5.7 PA Pat Toomey -17.8 -10.4 +7.4 WI Ron Johnson -24.1 -15.9 +8.2 In counties where Romney outperformed Trump … Calculations made using two-party vote shares Based on election returns from official sources

Burr’s and Johnson’s strong performances in particular suggest that Ayotte’s choice to un-endorse probably hurt her. Had Ayotte been able to run 2 percentage points ahead of Trump, who lost New Hampshire by just 2,736 votes, she would still be a senator today.

New Hampshire may not be the only state where a backlash from Trump voters cost the GOP a Senate seat. In Nevada, Republican Joe Heck also pulled his support from the Republican nominee after the Access Hollywood tape was released. A subsequent survey showed the move made 48 percent of Trump voters less likely to vote for Heck. In the end, Trump and Heck lost the state by nearly identical 2.4 percentage point margins, even though many Republicans expected Heck would outperform the top of the ticket.

Then there’s the case of Alaska Republican Lisa Murkowski, who may be Roby’s closest equivalent in the Senate. Until October, Murkowski hadn’t taken a clear position on Trump’s candidacy. But after watching the Access Hollywood tape, she quickly and vocally called for Trump to step aside. “It was instantaneous. When I saw the video, I said ‘I’m done, this is over,'” she told Alaska Dispatch News.

Trump wound up winning Alaska with 51 percent of the total vote, compared to 37 percent for Clinton. Meanwhile, Murkowski won re-election with an underwhelming 44 percent of the total vote. Joe Miller, a Tea Party-aligned conservative running as a Libertarian, took 29 percent.

In 2018, there will be 23 GOP representatives and one GOP senator up for re-election in places Clinton carried. And by next year, there could be far more Republicans facing re-election in places where Trump is unpopular. That may make it all the more tempting for these incumbents to avoid casting tough votes in line with White House priorities, thereby creating some distance between themselves and the president.

But in low-turnout midterm elections, an unmotivated or disillusioned base can be fatal. Just ask Democrats about 2010 or 2014.

There is no guarantee that Trump die-hards will feel motivated to stick up for GOP congressional candidates in 20 months’ time. In fact, as 2016 showed, one huge reason they loved Trump was that he railed against Republicans in Congress. And if you’re one of those incumbent Republicans, even in a blue state or district, there’s no faster way to lose authenticity or alienate the Trump base than to look like you’re constantly posturing. It just might cost you your job.