West Virginia Attorney General Patrick Morrisey prevailed in Tuesday’s West Virginia Senate Republican primary election, holding off coal boss Don Blankenship and averting a disaster for the DC establishment.

Morrisey will now face Democratic Sen. Joe Manchin in the 2018 general election, a top Republican target. It’s become something of a miracle the state still has a statewide Democrat at all, though Manchin has a long history within the state. But he’s in choppy waters. While it has a working-class Democratic history, West Virginia went for Donald Trump by 42 points and hasn’t gone for a Democrat in the presidential election since 1996.

“There’s a very strong anti-establishment sentiment in West Virginia, and there’s also an ‘it can’t get any worse’ sentiment,” Patrick Hickey, a political science professor at West Virginia University, told me. “We’re just trying to shake it up.”

Morrisey won 35 percent of the vote to best Blankenship (20 percent) and Rep. Evan Jenkins (29 percent), with more than 80 percent of precincts reporting.

Senate Republican leader Mitch McConnell and even President Trump himself were desperate to avoid a Blankenship nomination, fearing he would put an otherwise winnable seat out of reach. The president outright asked voters to support either Jenkins or Morrisey; he didn’t seem to really care which.

Morrisey ran on his record as attorney general, where he sued the Obama administration repeatedly over environmental regulations and other federal rules, while also taking a keen interest in the opioid epidemic that has ravaged the state. He positioned himself as the conservative outsider in the race, picking up the support of Sens. Rand Paul (R-KY) and Ted Cruz (R-TX) in his campaign. He has and will have to fend off attacks, though, that he is a relative newcomer to West Virginia and about his history working with drug manufacturers in the days leading up to the opioid crisis.

In Manchin, he’ll face one of the few Democrats still holding statewide office in such a Trumpian state, in a race that could be key for determining which party controls the Senate in November.

Can Joe Manchin hold on to West Virginia for Senate Democrats?

To win back the Senate in November, Democrats need to hold on to 10 Senate seats in states that Trump won. Going by the numbers, none is more challenging than West Virginia.

But Manchin has been elected statewide four times, as secretary of state, governor, and then US senator. His allies will point out that Manchin won reelection with 60 percent of the vote in 2012, the same year that Barack Obama got just 35 percent.

For now, Manchin is treading water with West Virginia voters: Morning Consult pegged him in April with 43 percent approval and 44 percent disapproval. Then again, the Wall Street Journal reported in March that a Republican poll found among GOP primary voters, Manchin was sitting pretty with 60 percent approval.

“Manchin is no stranger to running well above the party label here,” a West Virginia Democrat who supports Manchin told me. “It’s not a new thing for him to be his own brand, and the brand is still strong.”

Then again, some Democrats in the state think that could be his undoing. Manchin endorsed then-Democrat Jim Justice in the 2016 governor’s race — and then Justice switched parties after sworn in and became a Republican. In the eyes of some skeptical Democrats, it epitomizes the senator’s problems.

“Joe is gonna have the race of his life, truthfully. Liberal and progressive wings of the party are not enchanted with him,” Jeff Kessler, who ran for governor in 2016 against Justice, told me.

Manchin supporters roll their eyes, noting that labor unions like the state AFL-CIO are backing the senator and waving away the idea that Justice’s turncoat act could play a role in the Senate race.

“He pulled a fast one on everybody. That’s more the perception on the ground. It’s not a Manchin thing; it’s more of a Justice issue,” the Manchin-backing Democrat said, though Hickey told me that some Bernie Sanders supporters in West Virginia have not forgotten that Manchin supported Justice.

One wild card that could work in Manchin’s favor, as even Kessler acknowledges, is the teachers strike that took place in West Virginia this year. The state teachers walked out to demand a pay raise and better health care benefits from the GOP-led state government. Manchin appeared with them on the steps of the state capitol.

It was an unprecedented moment of political activism in the state. It seems at least possible that that energy will translate to anti-Republican votes in the fall.

“That will be an interesting thing to see,” Kessler said. “The teachers are extremely annoyed with the Republicans.”

But Manchin will still be fighting against that anti-government sentiment that seems so pervasive in West Virginia these days — and against Trump, who has put a target on the senator and remains overwhelmingly popular in the state.

“I think Manchin’s in a really tough spot too,” Hickey said. “He’s a career politician. He’s been around here forever.”