Virginia’s off-year gubernatorial races have long been an early sign of the national political mood ahead of midterm elections. This year, the contest in the commonwealth is testing something even bigger: Whether Democrats can navigate charged racial issues and win key races in the age of Donald Trump.

Republican nominee Ed Gillespie has been deluging the airwaves with ads bashing Virginia Lt. Gov. Ralph Northam (D) for supporting sanctuary cities and accusing him of being “weak on MS-13” gang violence and wanting to tear down the state’s confederate monuments. Northam has held a slight lead in most public polls of the race, but strategists in both parties think the Nov. 5 election could still go either way.

That has some Democrats nervous 20 days out from the election.

“If something were to happen and we were to lose that governor’s race, shit, Republicans are going to want to make every race in the country a referendum on MS-13,” said one Democratic strategist working on a number of races around the country. “We’re getting full Donald Trump primal scream racism up on the air right now. We’d better be able to beat it. … We don’t want these guys to learn the way to win a race is to turn it into a white power argument.”

While Democrats see Gillespie’s decision to pivot hard right on hot-button cultural issues like immigration as one way to shore up his weak base, they admit that they better be able to defeat him in Virginia if they hope to hold Senate seats in even tougher territory next year and make a real play for winning back the House.

Virginia has long been a harbinger of future elections. Big wins by Govs. George Allen (R) in 1993, Tim Kaine (D) in 2005 and Bob McDonnell (R) in 2009 all were early signs that their parties would have huge success at the ballot box the next year. Even current Gov. Terry McAuliffe’s (D) closer-than-expected 2013 win against hardline conservative Ken Cuccinelli (R) was an early sign that all was not well for the Democratic Party heading into a disastrous 2014 midterm cycle.

A trio of public polls released Tuesday found Gillespie within the margin of error, including one that showed Gillespie with a lead for the first time in the campaign.

A loss in a state President Obama and Hillary Clinton carried could also deal a major psychic blow to Democrats looking to bounce back in the age of Trump — especially after a disappointing loss in an open House seat in Georgia and near misses in a number of other heavily Republican House seats across the country.

“The history is really clear that Virginia is the early warning system,” said Democratic strategist Jesse Ferguson, a Virginia native who’s a veteran of the Clinton campaign and dozens of others in the state and nationally. “No one should expect this to be anything but close and no one should downplay how important it is that Democrats win. You can write off a special election in a congressional district we had no business competing in in the first place as an aberration. Virginia will be not an aberration but an indication of where we are in our efforts to claw back from 2016.”

Gillespie’s hard-right charge on immigration is a major reversal of his previous, big-tent approach to politics, as TPM previously documented. He once warned racial demagoguery against immigrants was a “siren song” that Republicans must resist. But lately he’s been walking the tightrope on the issue, campaigning with Vice President Mike Pence while dancing around whether he’d invite President Trump to stump with him, and campaigning in immigrant-heavy communities in more liberal Northern Virginia even as he airs the charged ads in heavy rotation elsewhere in the state. That’s a contrast with Northam, who’s holding a rally with President Obama on Thursday.

“The Gillespie folks have found they have to get their base out and that means moving into some of these more social appeals,” said former Rep. Tom Davis (R-VA), who said he thought Northam was better positioned to win but predicted a close finish. “These races are no longer going after the center, it’s all about getting your voters. You’re going after your base with a subtle dog whistle, but you’re not going over the top.”

Democrats nervously remember how things have played out in the state the last few years. While they’ve won most key statewide races this decade, McAuliffe’s narrow win after he led the polls by a comfortable margin in 2013 was followed by Gillespie almost upsetting popular Sen. Mark Warner (D-VA) in 2014 — a one-point margin no one predicted heading into election night. Hillary Clinton had a solid lead over Trump in Virginia for the entirety of the campaign, and an early alarm bell for her campaign on election night was Trump leading in Virginia early in the night before the big cities came in (she ended up winning the state by five points, similar to public polls).

Still, those elections came with Obama in the White House. Now, Trump’s there — and is about as unpopular in the commonwealth as nationally.

The MS-13 ads are particularly salient in Northern Virginia, where the Salvadorian gang has committed some heinous crimes in recent years, while the fight over removing Confederate monuments reverberates most in the more southern parts of the state — and is particularly charged in the wake of the white supremacist violence in Charlottesville.

Northam’s team says he has a small but steady lead — and Gillespie’s attacks are a sign of desperation. Northam’s response has been to outline his own law-and-order bona fides in ads while calling Gillespie’s attacks “a page from Donald Trump’s book.” His team recommends other Democrats do the same in highlighting their own candidates’ biographies to push back.

“He’s willing to do and say anything to get elected, principles be damned, and he’s getting desperate. He’s decided to go full Trump,” said Northam adviser Dave Turner. “People are seeing Ed Gillespie’s ads for what they are: Racially tinged Willie Horton style unmoored attacks.”

Gillespie’s campaign didn’t respond to requests for comment for this story. His allies dispute that his attacks are racially charged.

“Democrats have tried to use this issue and call it racist but … why would you want to give quarter to a gang that as recently as three months ago brutalized its victims?” Republican Party of Virginia Chairman John Whitbeck told TPM, pointing out that Northam did vote to protect sanctuary cities (even though none exist in Virginia). “I don’t know why Ralph Northam would put the rights of illegal immigrants over Virginians.”

Whitbeck said every election is now a base election — and predicted Gillespie’s move could send him to the governor’s mansion, demoralizing Democrats.

“In this particular era of polarization the turning out of your base is crucial to success. If you have the more enthusiastic voter side you’re likely to prevail,” Whitbeck said. “Democrats have tried to make every race a referendum on national politics, and they have lost every single one. If they lose this one, it will be a back-breaking blow to their narrative.”