Video still from a commercial for Ed Gillespie's 2017 campaign for Virginia governor. (N/A/Ed Gillespie for Governor)

Days before Virginia's tight gubernatorial election, Democratic nominee Ralph Northam is still facing questions about his stance toward "sanctuary cities" — localities that decline to enforce federal immigration laws.

Never mind that Virginia has no sanctuary cities. Or that there is no evidence that they lead to increased crime or gang activity. Republicans have seized on the issue as a way of portraying Northam as soft on crime.

And Northam is not alone.

In tight elections from New York to Albuquerque, Republicans are using sanctuary cities to attack Democrats as enabling Latino gang violence. Democrats, who have criticized the Trump administration for deporting undocumented immigrants with no criminal records, are struggling to explain their positions.

"I don't mind the term 'sanctuary city' if we define it, but nobody ever defines it," said Los Angeles Mayor Eric Garcetti, who leads the Latino Alliance of the Conference of Mayors. "If it means that our cops aren't going to be immigration agents, and that we'll build trust between communities, that's right. If sanctuary cities mean towns where we harbor criminals — come on, that's laughable. That's not what we are."

In Virginia, Northam has repeatedly walked into a trap set by Republicans. In January, President Trump threatened to cut off federal funds to sanctuary cities. In February, the GOP-controlled state senate forced Northam, the lieutenant governor, to break a tie on a bill that would have banned sanctuary cities in Virginia.

Thomas K. Norment Jr. (R-James City), the Virginia Senate's majority leader, initially voted against the ban — an odd move for the GOP leader to break from his party — but it set up a tie forcing Northam to go on the record on a contentious issue.

[Did Ralph Northam cast the ‘deciding vote’ on sanctuary cities?]

Ed Gillespie, who in June became the Republican nominee for governor, said he would have approved the ban.

That vote, as Democrats expected, became the focus of millions of dollars in attack ads, accusing Northam of leaving Virginians vulnerable to MS-13 gang violence. In TV ads, Northam said he had favored tougher laws against gangs; in debates, Northam called the February bill a "political trick."

But on Wednesday, he went further, telling Norfolk television station WAVY that he could sign a similar bill but only if a Virginia city actually declared sanctuary status.

View Graphic Virginia general election guide

"I've always been opposed to sanctuary cities," said Northam.

Republicans, who believe that the attacks were helping Gillespie close a polling gap, rounded on Northam for changing his position. So did some progressives, who accused the Democrat of flaking on a tough, moral issue.

[In a nod to conservaties, Gillespie urges ‘eradicating’ gangs and sanctuary cities]

"I want to elect Ralph Northam, but parroting Gillespie's hateful xenophobia is despicable," Ezra Levin, a co-founder of the grass roots Indivisible network of progressive groups, said in a tweet. "Find your spine, Ralph."

[Ad shows minority kids being chased by a truck sporting Gillespie sticker, Confederate flag]

Virginia voters, meanwhile, have been unsure what to think.

Chance McCracken, a bail enforcement agent in Virginia Beach, said he had not seen Gillespie's ads but learned on the radio that he opposed "sanctuary cities." He said he thought that meant some cities might not "report any felonies to [Immigration and Customs Enforcement] or the federal government" if Northam won.

"The general code of the street is you don't talk," said McCracken, 28. "It's more so with immigrants. The first thing they do is flee, and they're often hard to find because they don't have any documents."

But Cathleen Gormley, who supports Northam as well as some down-ticket Republicans, called the attempt to link gangs with sanctuary cities was "ridiculous." Many MS-13 gang members, she said, were born in the United States.

"They've been here for 25 years," said Gormley, 56, a lawyer who became familiar with the gang when she did juvenile law. "Just because you have immigrants in your state doesn't mean you're going to have MS-13 or any other gangs. They're not all immigrants."

Jeff Taylor, a Republican in Dinwiddie County, said that the state had "a lot of Latino immigrants, most of them good," but that he'd heard of sanctuary cities leading to more crime.

"I know some in California are pretty much letting them get away with murder," said Taylor, 57. "They're not pressing charges, because they're afraid they're going to get into the system where ICE can get to them."

There's no evidence that sanctuary status has any effect on crime rates, and some law enforcement groups have argued — like Garcetti — that they're less able to focus on violent crime if they're compelled to turn noniolent immigrants over to ICE. They also say undocumented residents who are crime victims or witnesses would be less likely to turn to local police if they believe the officials are working with federal authorities and will help deport them.

[In immigration crackdown, Trump targets sanctuary cities]

"Immigrants residing in our cities must be able to trust the police and all of the city government," the Major Cities Chiefs Association and the U.S. Conference of Mayors said in a joint statement earlier this year.

But across the country, Republicans have been using the sanctuary cities debate to win votes. In Albuquerque, a Democratic-leaning city where Republicans have controlled city hall for years, Republican mayoral nominee Dan Lewis warned that his opponent would put people at risk by not coordinating with ICE.

[To become governor, Gillespie shelves ‘big tent’ and goes for culture warrior]

"What's scary about that, what's dangerous about that, is we're talking about violent offenders," Lewis said in a debate last month with Democrat Tim Keller.

"That is absolutely wrong," Keller countered. "That is coded language. That is national talking points from the president."

In New Jersey, Republican gubernatorial candidate Kim Guadagno has spent weeks warning that Democrat Phil Murphy will turn the state over to criminals. At a town hall meeting in September, a worried constituent asked Murphy if undocumented immigrants who commit "a felony or drunken driving" should be reported.

"The field has been so tilted against the 'dreamers,' against immigrants, my bias is going to be having their back," said Murphy.

Guadagno, who has lagged in polls, grabbed hold of the issue. She ran TV ads about the grim 2007 story of an undocumented Peruvian immigrant who committed three murders. At a late October news conference, she said that Murphy had "disqualified himself" by suggesting he would let New Jersey police ignore orders from ICE agents and pointed to other crimes carried out by immigrants.

"Those are the types of people who get released back out into our communities when you declare yourself a sanctuary city," she said.

Not far away, in New York's Nassau County, Republicans have used a similar line of attack in a direct mail ad for Jack Martins, a candidate for county executive.

"Meet your new neighbors!" the mailer reads. "[Democrat Laura Curran] will roll out the welcome mat for violent gangs like MS-13!"

Even New York Mayor Bill de Blasio, who is expected to win a landslide reelection Tuesday, has been caught off-guard by a question about immigrants and crime. In January, when the Trump administration first targeted sanctuary communities, de Blasio appeared to be caught by surprise by a question about which crimes should be reported to ICE.

"Is grand larceny or drunken driving a very minor offense?" asked CNN's Jake Tapper.

"Drunk driving that does not lead to any other negative outcome, I could define as that," de Blasio said.

Comments like those worry some Democrats. Simon Rosenberg, the founder of the New Democratic Network and a strategist on immigration policy, said Democrats need to be more clear that they want ICE to focus on "felons, not families" — and that they needed to be ready to argue for some deportations.

"Democrats can say that President Obama was the leader who prioritized the deportation of criminals, and Donald Trump has taken his eye off the ball," said Rosenberg. "We got criminals out of the country. We policed the border. When Obama left office, there were fewer undocumented immigrants in this country than there were 10 years before. We're for deporting the violent criminals first."

Garcetti, who said he'd studied how crime was covered on Fox News — and how crimes involving immigrants were given special attention — agreed that Democrats needed to focus on law enforcement.

Democrats worry that even if Northam wins the close Virginia race Tuesday, Republicans will unleash waves of sanctuary city attacks into 2018. Rep. Lou Barletta (R-Penn.), who is running for Senate against Sen. Bob Casey (D-Penn.), said that the issue was increasingly breaking his way — and Trump's way.

"Pennsylvania's a blue-collar state," said Barletta. "Sanctuary citizens become safe havens for terrorists and people in the country illegally. People are going to understand that."