CHARLESTON, W.Va. — Don Blankenship, a former coal baron who went to prison for his role in a deadly mine disaster, was soundly defeated in the West Virginia Republican Senate primary on Tuesday, according to The Associated Press, after President Trump and other Republicans urged voters to reject him.

The state’s attorney general, Patrick Morrisey, captured the party’s nomination and is expected to mount an aggressive challenge this fall against Senator Joe Manchin III, a Democrat who is a top target of Republicans in their struggle to hang on to their one-seat Senate majority in the midterm elections in November.

Mr. Blankenship, who called himself “Trumpier Than Trump,” drew on elements of the president’s own populist playbook, including nativist attacks and charges of conspiracy leveled at the Obama-era Justice Department that prosecuted him for his role in the 2010 mine explosion, which killed 29 men.

But Washington Republican leaders badly wanted Mr. Blankenship to lose, with the Senate majority leader, Mitch McConnell, coordinating an effort to derail him. At Mr. McConnell’s urging, Mr. Trump on Monday warned “the great people of West Virginia” in a tweet that Mr. Blankenship could not win the general election against Senator Manchin.

Mr. Blankenship said Tuesday night that he thought the tweet cost him 10 percentage points or more. He ended up receiving 20 percent of the vote, compared to almost 35 percent for Mr. Morrisey.

Mr. Blankenship ran a nonpolitician’s race from start to finish. His TV ads were on the air months before those of other candidates, and rather than emphasizing his conservative bona fides — the chief driver of voters in a Republican primary — he spent deeply from his fortune to attack the Justice Department for his conviction.

Unpredictable to the end, Mr. Blankenship went shopping for a new suit in Charleston on Tuesday rather than campaigning. Hours later, at his election-night event at a modest-size corporate ballroom in a Marriott hotel, he took the stage after only about 35 percent of votes were in to deliver a sort-of concession speech in a matter-of-fact tone. There were more journalists than supporters in the room, including two Mandarin speakers from the Voice of America, who said they were broadcasting into China because of interest there over racially offensive comments by Mr. Blankenship.

Don Blankenship at his watch party during on Tuesday.

“The news so far is not very good,” he told the audience. “We’re really disappointed by some of the votes in the northern panhandle,” he continued. “At this point it’s not nearly what I hoped it would be.”

Then Mr. Blankenship asked whether anyone had questions, and fielded them from both supporters and reporters. He said he may not endorse Mr. Morrisey, repeating campaign attacks that the attorney general is not strongly enough opposed to abortion or opioids. And he was inconclusive about whether…