State Attorney General Patrick Morrisey won the Republican U.S. Senate nomination in West Virginia on Tuesday, beating former coal executive Don Blankenship and calming the fears of Republican party leaders who thought the brash ex-convict would spoil their chance to pick up a Senate seat.

Morrisey will now face endangered Democratic Senator Joe Manchin, a prime target for Republicans, in one of the top Senate races of November’s midterm elections.

Blankenship had panicked Republican leaders by showing signs of a late surge, but he faded to a third-place finish behind Morrisey and U.S. Representative Evan Jenkins after President Donald Trump intervened to urge voters to reject him.

The divisive Blankenship, who served a year in prison for safety violations in a 2010 disaster that killed 29 miners, included attacks on Senate Majority Leader Mitch McConnell for creating jobs for “China people” and ads highlighting the Taiwanese heritage of McConnell’s wife.

Blankenship told supporters in Charleston, West Virginia, that he had no regrets about his campaign and blamed the “establishment” for the loss. “I think if there was any single factor … it was President Trump’s lack of endorsement,” he said.

 Trump, who won the state by more than 40 percentage points in 2016, had urged voters in a tweet on Monday to support either Jenkins or Morrisey.

The race was the highlight of primary contests in four states that showed how Trump has taken over the Republican Party, with candidates in all the major races competing to prove the depth of their allegiance to him.

Republicans also waged bitter Senate primary battles in Indiana and Ohio, two other states that Trump won in 2016 and where incumbent Democratic senators are up for re-election this year in key races in the battle for control of Congress.

Democrats need to pick up two Senate seats and 23 House of Representative seats in November to regain majorities in Congress and blunt Trump’s agenda.