IN VIRGINIA, the only state in the Old Confederacy carried by Hillary Clinton last year, the front-runner for the Republican nomination for governor is trying not to talk about the president. Ed Gillespie, an establishment Republican who worked for George W. Bush and was chairman of the Republican National Committee, is one of three candidates vying for the Republican nomination in the primary on June 13th. But he seems to have little to say about the controversies dogging Donald Trump's new administration.

They include the Republican replacement for Obamacare that could choke off health funds to the Virginia countryside, a Republican Party bulwark; Mr Trump’s firing of James Comey, who made his name as a federal prosecutor in Richmond; and a proposed federal budget that would mean fewer Navy shipbuilding contracts for a Virginia yard and less cash for a cleanup of the Chesapeake Bay, gateway for the first English settlers in the early 1600s.

That is not surprising. A recent poll by the Washington Post offered a stark reminder of Mr Trump’s unpopularity in Virginia, suggesting it could mean a double-digit defeat for Mr Gillespie against either of the two Democrats standing for their party’s gubernatorial nomination. Not surprisingly, those Democrats are attempting to harness anti-Trump rage to elevate turnout in their primary next month and to lure independents and never-Trump Republicans in the vote on November 7th.

Virginia and New Jersey are the only states choosing governors this year. That makes their elections early, mini-referenda on Mr Trump. Because New Jersey is deeply blue, the contest in Virginia—a purple, swing state with a divided government and an increasingly diverse electorate—could prove a more telling measure of the president’s standing.

For Republicans, the gubernatorial election could signal their demise as a statewide party. All of the offices determined by a statewide vote—governor, lieutenant-governor, attorney-general and the two US senators—are held by Democrats. That is because Democrats are strongest where the votes are most abundant: the cities and suburbs concentrated in eastern Virginia, a magnet for prosperous, highly educated newcomers who have brought from their home states—domestic and foreign—a preference for moderate-to-liberal politics.

Republicans increasingly find themselves stranded in the countryside, the seat of an aging, white conservative population. Republican isolation is exacerbated by the party’s legislative gerrymandering, which extends disproportionate power to a narrow band of right-leaning voters who can have little in common with Virginia as a whole.

Mr Gillespie’s two opponents for the Republican nomination, Corey Stewart and Frank Wagner, have a more positive view of Mr Trump. That is in part because they badly lag Mr Gillespie in fundraising. Lacking the cash for sustained advertising, they to varying degrees publicly align with the president, in the hope that his voters can be theirs.

Mr Stewart has taken this to extremes. An immigrant-hostile local government official from the Washington suburbs— themselves a salamagundi of foreign newcomers—Mr Stewart is using a full-throated defence of the slave-holding Confederacy and its iconography apparently to attract white nationalists. He is perhaps a less-than-convincing Rebel, having been born and raised a Yankee. A chairman of the Trump campaign in Virginia until he ran afoul of its high command, Mr Stewart is a native of Minnesota, a state that banned slavery when it was admitted to the union in 1858.

Mr Wagner, meanwhile, should be strong candidate. He has been a state legislator for 25 years, which has given him something his opponents lack: first-hand knowledge of Virginia government. And Mr Wagner has a vote-rich political base in southeastern Virginia, a region thick with military installations, the businesses that support them and a vast shipping industry that sprang up around the deep-water port of Hampton Roads.

Mr Wagner will occasionally speak up for Mr Trump, but it may not come across as sincere. He favoured John Kasich, the governor of Ohio and an unsparing Trump critic, for the presidential nomination. Furthermore, Mr Wagner is betraying an article of faith for Republican Party primary voters, by advocating higher taxes for transportation.

Another obstacle stands in the way of Mr Stewart and Mr Wagner: a reservoir of goodwill among Republicans for Mr Gillespie because of his near-win in 2014 over Mark Warner, the supposedly unbeatable senior Democratic US senator who is now one of the leaders of the Senate Intelligence Committee investigation of Russian meddling in the presidential election.

On the Democratic side, meanwhile, there wasn’t supposed to be a primary. The presumed consensus nominee was Ralph Northam, the lieutenant-governor. He had been endorsed by nearly every elective Democrat in the state as well as politically muscular labour and abortion-rights organisations. With his folksy rural drawl, paediatric medical practice and decade in state government, Mr Northam seemed another easy sell to election-deciding independents and disaffected Republicans.

But in January, a congressman-turned-Africa diplomat declared for the Democratic nomination. Tom Perriello, who hasn’t held elective office since he was defeated for a second term in the House of Representatives in 2010, made clear his candidacy was about Mr Trump and stopping the spread of his politics and policies, starting with the disputed Muslim ban that was blocked on May 25th by a federal appeals court in Richmond. They are powerful themes, particularly when espoused to the Democratic faithful by a skilled rhetorician like Mr Perriello.

If only because of his verbal acuity, high profile on social media and endorsements by such national Democratic celebrities as Bernie Sanders, Mr Perriello has made it a neck-and-neck race with Mr Northam.

So Mr Perriello brings upset potential to a contest in which Mr Northam’s organisational advantage was supposed reduce the nomination to a formality. That was not what many Democrats were expecting. But then, they were also expecting a Clinton presidency.