In race after race on Tuesday, Democrats voted to support the more electable-looking candidate to stop Republicans.

In Ohio, voters set up one of the year’s marquee gubernatorial races with the choice of Democrat Richard Cordray, who ran the Consumer Financial Protection Bureau under President Barack Obama, over former congressman Dennis Kucinich to face longtime state Attorney General Mike DeWine.

Kucinich’s run was seen as a test of whether Democrats would back left-wing candidates against the “establishment.” But in Ohio and other states, the party’s left fell short as better-funded candidates easily won their primaries.

In Indiana’s 2nd district, a health-care executive named Mel Hall, who had donated to both Democrats and Republicans, ­defeated candidates who backed a “Medicare for All” single-payer health-care system. In West ­Virginia’s 3rd District, state Sen. Richard Ojeda (D) romped to a win — even after telling primary voters that he had backed Trump in 2016. And in North Carolina’s 9th and 13th districts, moderate Democrats won landslides over more left-wing challengers.

The reasons were clear even at Kucinich’s election night party, where voters who had considered Cordray to be too moderate on guns and health care said they’d back him in November.

“I will be fine supporting Cordray,” said Melanie Wilson, 35, as she waited for results at Kucinich’s party in Cleveland. “We definitely want a Democrat to win in November in Ohio. We need that.”

After he conceded defeat, Kucinich called on supporters to respect the voters’ opinion.

“I think that all of us here should join in congratulating him on his election,” he said.

Kucinich, who entered the race four months ago, tried to make the election a referendum on gun control, universal health care and criminal justice reform. He attacked Cordray as a ­“Republican-lite” candidate who had once been backed by the National Rifle Association and refused to support a ban on firearms considered assault weapons.

But in April, Cordray dominated the airwaves while Kucinich spent nearly two weeks answering for a $20,000 payment he had taken from a group allied with Syrian President Bashar al-Assad. Even after Kucinich returned the money, his momentum stalled out. While Cordray’s ads advertised his work with President Barack Obama, ­Kucinich’s ads featured an endorsement from Rep. Tulsi Gabbard (D-Hawaii), who has been criticized for meeting with Assad.

“Kucinich bothered me because of the whole Assad thing,” said Robert Halpin, 57, after voting in Cleveland. “I didn’t like Cordray because of the NRA. But in the end, weighing it, I don’t like Assad more [than I don’t like the NRA], so I went with Cordray.”

Cordray will face DeWine, who locked up Republican Party support and enjoyed a big lead in polls despite attacks from opponent Lt. Gov. Mary Taylor, who accused the former senator of “voting with Hillary Clinton 962 times.”

Both Taylor and DeWine have talked about undoing the ACA’s Medicaid expansion in the state, a point of pride for Republican Gov. John Kasich. Cordray promised to protect the expansion, and add more coverage for addiction and mental health.

“I congratulate Mike DeWine tonight for winning one of the ugliest campaigns I’ve ever seen,” Cordray said at his victory party. “We now have a clear choice in November, and the things we stand for cannot be more different.”

Democrats, who had seen turnout jump in this year’s Illinois and Texas primaries, had a more mixed picture from Tuesday’s races.

In West Virginia, where once-dominant Democrats have been losing their registration advantage, more than 150,000 voters backed either Sen. Joe Manchin III (D) or his left-wing primary challenger, Paula Jean Swearengin and just over 130,000 voted in the more competitive Republican race. The GOP number was up about 50 percent over 2014, when neither party had a competitive race, while the Democratic one was up 14 percent. Democrats also had an approximately 20,000-vote advantage in the primaries in the state’s 3rd District.

In North Carolina, two Republican-leaning districts saw a surge in Democratic turnout. But in Indiana, which had been trending Republican, the total vote in the Senate primary was roughly the same as it had been in 2010, the last open primary in a midterm year.

In Ohio, with 93 percent of precincts reporting, more than 800,000 votes had been cast in the Republican gubernatorial primary, compared with slightly less than 640,000 votes in the Democratic primary. That was up from 2014, when just 440,253 votes were cast in a relatively uncompetitive Democratic primary. But it was a reversal from this year’s early voting, which had Democrats ahead.

Democrats entered Tuesday confident in their other statewide races in Ohio, in which the party’s favored candidates were expected to win nomination easily. Sen. Sherrod Brown (D), who is up for reelection this year, will face Rep. James B. Renacci (R-Ohio) — and, according to FEC filings, will start with a 3-to-1 cash advantage.

Democrats were paying more attention to three races for Congress in areas carried in 2016 by Trump. Voters in the 12th District, which covers the suburbs north and east of Columbus, were picking the nominees for an Aug. 7 special election to replace Republican Patrick J. Tiberi, who abruptly retired to take a private-sector job.

Democratic voters nominated Danny O’Connor, the elected recorder of Franklin County, who led the field in money and endorsements. State Sen. Troy Balderson, who was endorsed by Tiberi, narrowly won the 11-way race for the Republican nomination with a promise “to use conservative grit to build the darn wall.”

“I know a lot of people down there,” said Rep. Tim Ryan (D-Ohio), who had been talking up O’Connor to fellow Democrats. “They may not be Democrats. They may be independents or moderate Republicans. That kind of positioning is not what they want.”

Rep. Steve Stivers (R-Ohio), chairman of the National Republican Congressional Campaign Committee, said that any leading candidate could hold the 12th District.

“We’re going to win this race,” he said. “I think we’ll come out of this in a way where we’ll have a really strong nominee that will be able to hopefully win it on their own.”

The Democrats’ preferred candidates also prevailed in the Canton-based 7th District, where Navy veteran Ken Harbaugh defeated a left-wing rival, and the Cincinnati-based 1st District, where Hamilton County Clerk Aftab Pureval has outraised incumbent Rep. Steve Chabot (R-Ohio).

Republicans had already taken some defensive action in the 7th District, with mail attacking Harbaugh’s underfunded primary challenger as “too liberal for Ohio” — a message intended to split Democratic voters. But that attack encouraged Democrats, who had watched Rep. Robert Gibbs (R-Ohio) win a 41-point landslide in 2018, to think that the district might be winnable.

“I’ve been trying to spread the word up here — we’ve got some young, dynamic candidates in Ohio,” said Ryan.

Afi Scruggs in Cleveland and Mike DeBonis in Washington contributed to this report.