Opinion writer

The Virginia governor’s race, which became a referendum on President Trump and his anti-immigrant hysteria, demonstrated that anti-Trump Republicans and Democrats still have a pulse. With about 80 percent of the vote currently counted, The Post has called the race for Democratic Lt. Gov. Ralph Northam over Republican Ed Gillespie.

Exit polls show that twice as many people used their vote to send a message of opposition to Trump as those who said they wanted to send a message of support. A traditional coalition of women (+19 points), minorities, college-educated voters (who made up 59 percent of the electorate) and suburban voters rallied to Northam. Among two critical groups — white college-educated women and married women — Northam won handily. Northam ran up huge margins in D.C. suburbs and exurbs. Unfortunately for Gillespie, voters indicated the top issue was health care — not crime or immigration.

Trump won’t be able to avoid getting tarred for this one. He surely made his presence felt. On Monday and Tuesday, a Trump robocall flooded the state. On Election Day, he started off with two obnoxious, demonstrably false tweets. He first claimed, “Ralph Northam will allow crime to be rampant in Virginia. He’s weak on crime, weak on our GREAT VETS, Anti-Second Amendment…” Northam served in the Army as a doctor for eight years; Trump avoided serving in Vietnam with claimed bone spurs.

Trump then claimed Gillespie “will totally turn around the high crime and poor economic performance of VA.” Unemployment in the state is 3.7 percent, below the national average. In 2015, Virginia ranked as having the third-lowest violent-crime rate and 10th lowest for property crime. So for those voters still undecided, Trump added a last-minute reminder that a vote for Gillespie would be a vote for him — and for Trumpian politics of out-and-out lies and fear-mongering.

Trump is deeply unpopular with Virginia voters. Some 55 percent disapprove of the job he is doing, according to exit polls. By contrast, the incumbent Democratic Gov. Terry McAuliffe rates 11 percentage points higher in approval (53 percent) than Trump (42 percent).

The lion’s share of the blame for the GOP loss, however, rests with Gillespie, once the epitome of Republican establishment politics and a former adviser to pro-immigration President George W. Bush. Gillespie made the decision to ape his primary opponent Corey Stewart (an avid pro-Trumper and defender of Confederate statues) — and Trump. He decided to embrace the cause of preserving Confederate statues. He adopted a harsh tone on immigration. He ran ads depicting Hispanic gang members and hyped the danger of so-called sanctuary cities, which don’t exist in Virginia.

As we wrote throughout the race, Gillepie’s abrupt turn toward right-wing populism was a risky move considering the changing composition of Virginia. The bulk of recent population gains have been in Northern Virginia, which trends Democratic. White-collar workers, suburban professionals, and minority and younger voters have helped tip the state Democratic in recent years. The last statewide Republican winner was Bob McDonnell in 2009. He carefully maintained the image of a reasonable, non-extreme conservative. (He actually won Fairfax County, something no other Republican in a statewide race has done since.)

Gillespie’s strategy, if it were to work, depended on juicing up red areas in southwestern Virginia and hoping Northern Virginians didn’t turn out. But that strategy didn’t work for Trump in 2016, who lost the state by five points, and it therefore was always a long shot for a Trump imitator, someone barely recognizable to those who knew him as a middle-of-the-road Republican. Moreover, Northern Virginians turned out in huge numbers, perhaps in order to send that anti-Trump message.

Trumpians will claim Gillespie didn’t embrace Trump enough, of course. (The Dear Leader is never a liability, you see.) In 2017, however, there simply are not enough pro-Trump voters in the swing state to make up for the voters enraged by Trump and his tactics. (One cannot help but notice that former president Barack Obama campaigned in the state for Northam, while Trump was too toxic to show up for Gillespie.)

Northam did not run a fabulous race. However, he ran a good-enough race and was able to hold onto Northern Virginia Democrats, independents and enough anti-Trump Republicans to carry him to victory. Liberal turnout was high (28 percent of the electorate), although their favorite candidate Tom Perriello lost in the primary. Northam stuck to the same middle-of-the-road agenda that McAuliffe has deployed. Given McAuliffe’s popularity, that was a wise move in a middle-of-the-road state.

There will be plenty of time to dissect the implications of the race. For now, the overwhelming emotion among Democrats is relief. For Republicans this should serve as a warning that getting close to Trump may be injurious to one’s political career — and race-baiting doesn’t always work.