Democrats are nervous about how they’re concluding the biggest election of 2017, with some growing increasingly concerned that missteps and internal feuds are hurting their chances of winning Virginia’s crucial gubernatorial election Tuesday.

The last week of the race has thrown Lt. Gov. Ralph Northam’s (D) campaign on the defensive, as he’s struggled to grapple with blowback from a charged ad from an allied outside group, overreacted with a promise to ban sanctuary cities if needed and took a beating from some progressives.

Democrats still think they’re likely to hang on and win the race. But the back-biting and finger-pointing has distracted Northam and helped unite Republicans as he looks to grind out a win against GOP nominee Ed Gillespie’s racially charged campaign in the biggest test so far of Democratic organizing ability and electoral strength since Trump’s 2016 victory.

“Everyone’s just scrambling to shit the bed at once,” one longtime Virginia Democratic strategist told TPM, slamming the chirping from left-wing groups while calling Northam’s waffling on sanctuary cities “bizarre.”

“It’s difficult to watch as a Virginian who really doesn’t want Ed Gillespie as governor.”

The Democrat strategist — and most Democrats — still think Northam will hold on to win the race in a state Hillary Clinton carried last fall. But many are frustrated at the infighting that’s taken place in the race’s last week, with progressives furious at Northam’s caution and moderation and Northam allies maddened by unhelpful liberal bedwetting.

“People are screwing up,” said another Democrat who’s working on Virginia races, warning a Northam loss would “signal that the wave is not what we think it is, it cool a lot of fundraising and enthusiasm and really force people to reevaluate 2018.”

There has been grumbling on the left for months that Northam wasn’t doing enough to boost minority and progressive turnout. But it came to a head in recent days when the Latino Victory Fund, a Hispanic outside group worried that Northam hadn’t done enough to gin up Latino turnout, launched a controversial ad tying Gillespie’s racially charged ads to Donald Trump and the Charlottesville white supremacist violence. Conservatives jumped on the ad, in which a white man driving a pickup with a Confederate flag and Gillespie sticker chases down minority children, saying it implies all Gillespie supporters are racists.

The spot was quickly pulled down, but not before it triggered a backlash on the right that Republicans say has helped galvanize their supporters behind Gillespie. Northam didn’t help himself any as he sought to clean up the mess, declaring for the first time that he’d sign a bill to ban sanctuary cities in the commonwealth if any were established.

“If that bill comes to my desk, Andy, I sure will,” he told a local news anchor on Wednesday. “I have always been opposed to sanctuary cities.”

That’s a new position for Northam after months of him dismissing Gillespie’s attacks on the topic as racially charged scare-mongering since no sanctuary cities exist in the commonwealth — and after he cast the deciding vote to block a sanctuary cities bill in the legislature that Gillespie’s allies had cooked up to force him to vote on it.

Many liberals were apoplectic. And to make things worse, the national liberal group Democracy for America responded by un-endorsing Northam while calling him a “racist” for his stance.

“After seeing Northam play directly into the hands of Republicans’ racist anti-immigrant rhetoric on sanctuary cities, we refuse to be silent any longer and even remotely complicit in the disastrous, racist, and voter-turnout-depressing campaign Ralph Northam appears intent on running,” DFA Chairman Charles Chamberlain said in a statement Thursday.

Democrats say DFA is more bark than bite, and rarely helps in big ways in close races. Even the group’s founder, former Vermont Gov. Howard Dean (D), blasted the move:

I Hope this is inaccurate because it is an incredibly stupid thing to say and deeply discredits the organization which I founded. https://t.co/pBNnR0AMnC — Howard Dean (@GovHowardDean) November 3, 2017

Democrats are concerned that a Gillespie win or even a close finish will encourage Republicans to replicate Gillespie’s dog-whistle campaign across the country next fall and pour fuel on the fire of the establishment-progressive battle within the Democratic Party. That battle is already raging once again in the wake of former Democratic National Committee interim chair Donna Brazile’s recent charges of “unethical” interactions between the DNC and Hillary Clinton’s campaign during the primary.

“I watch Virginia with great worry in part because of [Gillespie’s] dog-whistle politics … but also because the Democrats, the top of the ticket … are not able to run on big political and economic change,” Democratic pollster Stan Greenberg, a Clinton campaign veteran who says Democrats must embrace left-wing populism more, told TPM during a Thursday conference call. “It doesn’t feel like they have learned the lessons from ’16.”

Northam pushed back on that characterization Friday afternoon.

“I have fire in the belly, too, to bring civility and leadership to Virginia,” he said on MSNBC.

Democrats admit it’s a tight race.

“I think it’s going to be close,” Rep. Bobby Scott (D-VA) told TPM last week before the Democratic infighting broke fully into the open.

Scott said Gillespie’s attack ads on removing Confederate monuments and accusing Northam, a pediatrician, of protecting a child predator were “despicable” — but worried they might be working.

“They wouldn’t have done it if they hadn’t taken a poll,” he said.

It almost worked for Gillespie three years ago, when he surged to almost upset Sen. Mark Warner (R-VA) with late-in-the-race culture warrior ads defending the Washington Redskins’ team name.

Northam’s campaign insists everything’s fine, pointing to strong early vote numbers in Northern Virginia.

“We have seen historic levels of volunteer activity, small donor donations, and primary turnout,” Northam spokesman David Turner told TPM. “We are confident going into Election Day because the Democratic ticket is resonating with Virginians.”

Sen. Tim Kaine (D-VA) told TPM last Thursday that Northam had a “solid, steady lead” but not a “spectacular” one, and reiterated his longtime prediction that the race would be close.

Kaine said a Northam win “would send a good signal to Democrats going into 2018 that in a bellwether state people are embracing quality over demagoguery” and “bode well for the politics of 2018.”

But what if Gillespie wins?

“Ask me when it’s over.”