Sen. Joe Manchin (D-W.V.) won his re-election contest on Tuesday, the AP projects, defying Republican efforts to flip a Senate seat in a state that Donald Trump had won by more than 40 points two years prior.

Manchin defeated his opponent, West Virginia Attorney General Patrick Morrisey, by several points.

The senator, who had been courted by the Trump administration to switch parties and even join the cabinet, positioned himself as a centrist problem-solver during his campaign. And he took votes that angered his base in pursuit of that image; none more so than his decision to back Justice Brett Kavanaugh’s nomination to the Supreme Court.

But it was Manchin’s position on health care that seemed to propel his victory more than any other issue. Manchin made protecting insurance for people with pre-existing conditions the centerpiece of his campaign and attacked Morrisey relentlessly for his decision to join a lawsuit challenging the constitutionality of the Affordable Care Act’s remaining provisions, including the one dealing with protections for those with pre-existing conditions.

Morrisey seemed to never find his footing under those attacks. He went after Manchin for his party affiliation and for the fact that Manchin’s daughter Heather Bresch is the CEO of Mylan Pharmaceuticals (that infamously hiked the price of the EpiPen by 600 percent). But Morrisey had vulnerabilities of his own on this front: his wife was a lobbyist for Cardinal Health, the largest opioid distributor in West Virginia.

National Republicans had hoped that Trump’s popularity in the state would have pushed Morrisey over the top. And the president did make a swing through during the closing days of the election, but, ultimately, it was not enough.