The defeat of Rep. Thomas Massie in Kentucky’s 4th Congressional District Republican primary on Tuesday removed one of the most persistent internal critics of President Donald Trump from the House, delivering Trump another victory in his campaign to purge dissenters from the party. Ed Gallrein, a challenger endorsed by Trump, defeated the seven-term incumbent, the Associated Press reported.

The race had emerged as a high-profile test of Trump’s tightening grip on Republican officeholders. Trump made Massie a target after years of friction, attacking him on social media as “an obstructionist and a fool.” Massie had voted against major Trump initiatives, bucked party leadership on spending bills, and was among the few Republicans willing to openly criticize the president.

In the primary’s final stretch, Massie sought to insulate himself by campaigning with other Trump-aligned Republicans, including Colorado Rep. Lauren Boebert, and argued that voters could support both him and the president. Gallrein countered by appearing with Trump’s Defense Secretary Pete Hegseth on the eve of the election and leaning heavily on Trump’s endorsement.

Massie’s loss leaves the House Republican conference without one of its most libertarian-leaning members. First elected in 2012, Massie had consistently drawn attention for his contrarian votes and was a fixture of the party’s small-government wing. His defeat, coming after Trump successfully targeted other incumbents in prior primaries, illustrates the extent to which deviation from Trump’s agenda now carries electoral risk in Republican primaries.