Congressman Thomas Massie, one of the most vocal Republican critics of Donald Trump, has lost his fight for re-election to a challenger endorsed by the president.

Ed Gallrein, a former Navy Seal, will now compete in November’s midterm election after his victory in the Kentucky primary on Tuesday.

The contest, the most expensive primary in the history of the House of Representatives, had been widely seen as a key test of President Trump’s decade-long grip on the Republican Party.

Trump repeatedly called for voters to back Gallrein over the incumbent Massie, who he described as a “major sleazebag” and “the worst Republican congressman in history”.

Massie, who has been in office since 2012, publicly broke with Trump by voting against his “big, beautiful” tax and spending bill last year over concerns about the national debt. He has also voted to curtail Trump’s attacks on suspected drug boats in the Caribbean and his ongoing war in Iran.

Massie also joined with Democrats - and a handful of Republicans - to force Trump’s Department of Justice to release all of its files on Jeffrey Epstein.

He lost by 55 percent to 45 percent in the vote on Tuesday, marking a major victory for Trump who has successfully ousted a number of dissenting Republicans by endorsing a more loyal challenger.