In September, Ed Gillespie, the Republican candidate for governor of Virginia, started running a television ad linking his opponent, the Democrat Ralph Northam, to a murderous Salvadoran-American street gang called MS-13. The ad, which opened with the gang’s motto (“Kill, Rape, Control”), featured footage of tattooed gangsters in a Salvadoran prison. The narrator accused Northam of “letting illegal immigrants who commit crimes back on the street, increasing the threat of MS-13.” Democrats likened the ad to the infamous Willie Horton attack ad run against Michael Dukakis, from George H. W. Bush’s 1988 Presidential campaign. A number of prominent Republicans—including Al Cardenas, the former head of the American Conservative Union, and the columnist George Will—joined the critics, too, lamenting that Gillespie, a longtime G.O.P. insider who had fended off a Trump-like insurgent in the Republican primary, had adopted Trumpian tactics in the general election. A former colleague, the political consultant and author Gabriel Schoenfeld, who worked with Gillespie on Mitt Romney’s 2012 Presidential campaign, described him as “a great guy now covering himself in filth.”

The ad was effective, however. The race—in which Northam was favored—tightened, and polling suggested that voters increasingly preferred Gillespie on the issues of crime and public safety. In February, Northam cast the tie-breaking vote against a Republican-backed bill in the Virginia Senate that would have banned sanctuary cities—municipalities where local officials limit their coöperation with federal immigration authorities. Virginia doesn’t have any sanctuary cities, and Republicans had set up the vote to force Northam into taking a position on the record. As Tuesday’s election has drawn closer, he’s vacillated. Last month, during a debate, he queasily conceded that he wouldn’t support sanctuary cities if they existed in Virginia, and, last week, he backtracked further. “I’ve always been opposed to sanctuary cities,” he told a reporter. If a bill banning sanctuary cities came to his desk, he would sign it as governor, he said. I called the Northam campaign to ask how this squared with Northam’s vote in February. His communications director, David Turner, told me that Northam had consistently opposed sanctuary cities—in theory. “We’re now talking about a hypothetical about a hypothetical,” he said.

Last November, Hillary Clinton won Virginia by five points, mostly by running up sizable margins in metropolitan hubs across the state and in the northern suburbs. The rural parts of the state, which are reliably Republican, voted overwhelmingly for Trump. “Gillespie is counting on lower turnout in northern Virginia, where he has to make sure Northam doesn’t run away with it,” Geoffrey Skelley, of the University of Virginia Center for Politics, told me.

Counties in the northern part of the state—like Loudoun and Fairfax—typically go for Democrats, but the area has also seen a rise in gang-related killings over the last few years. As both a candidate and as President, Trump has made MS-13 a byword for immigrant crime in the U.S. He’s called the gang’s members “animals,” and has warned that “we’ve got a lot of them out there. But the rest are coming.” (The Justice Department has estimated that there are about six thousand MS-13 members in the U.S.) Gillespie and the members of his campaign, who have otherwise avoided being associated with Trump, saw an electoral opportunity in this, and the President has been happy to help. In October, Trump tweeted, “Ralph Northam, who is running for Governor of Virginia, is fighting for the violent MS-13 killer gangs & sanctuary cities. Vote Ed Gillespie!”

The Trump Administration has made opposition to sanctuary cities one of the core principles of its immigration agenda. In January, the President tried, unsuccessfully, to ban them by executive order, and his 2018 budget threatened to rewrite a federal statute in order to strip such cities (including New York City and Los Angeles) of some of their federal funding. Jeff Sessions, the Attorney General, has crisscrossed the country this year giving speeches about how sanctuary cities contribute to crime, drugs, and other dangers. In those speeches, talk of sanctuary cities often leads into a recitation of the horrors perpetrated by MS-13. Researchers have found no connection between sanctuary policies and gang crime, but the link is intuitive: sanctuary cities are portrayed as havens for lawlessness and impunity. Since Trump’s election, at least nine state legislatures have proposed legislation against sanctuary cities, including one bill, in Texas, that was opposed by state police chiefs and sheriffs. “If the President had not talked about MS-13 as an issue, it would not have been an issue in Virginia,” Abel Nuñez, the executive director of the immigrant-aid group Carecen, and a longtime resident of the Washington, D.C., metropolitan area, told me. “It’s in vogue right now because of the President. Gillespie is a smart politician to use it.”

In the race for the other governor’s office up for grabs on Tuesday—in New Jersey—the Democratic candidate, Phil Murphy, has tried to make an affirmative case for sanctuary policies, and has pledged to turn New Jersey into a sanctuary state. Polls show him with a commanding lead over his Republican rival, Kim Guadagno, who has served as lieutenant governor to the extremely unpopular Chris Christie. Guadagno, for her part, launched her campaign at a Mexican restaurant, and has hewed to a centrist platform—promising to support a Medicaid expansion under the Affordable Care Act, vowing to rejoin the Regional Greenhouse Gas Initiative, and defending strict gun laws. But last month, during a televised debate, she accused Murphy of defending a “child rapist” who took part in the murder of three Newark teen-agers in 2007. A subsequent TV ad, which emphasized that the criminal had been an undocumented immigrant, pilloried Murphy for having the “backs of deranged murders.”

This was a shift in rhetoric, and many observers pointed to the Guadagno campaign’s recent hiring of Adam Geller, who was the Trump campaign’s pollster in Wisconsin and Michigan in 2016. (Geller also worked on Christie’s successful 2009 and 2013 campaigns for governor.) Geller and I spoke on the phone last week. “I will tell you from my polling that Americans and New Jerseyans don’t have a problem with immigration,” he said. “They have a problem with illegal immigration, and with violent criminals like MS-13. We’re not talking about immigration or immigration policy. We’re talking about crime.” Christie, Geller’s former boss, had adopted a number of immigrant-friendly policies as governor. I asked Geller what had changed since Christie made those decisions. “That was such a different world,” Geller said. “The state is undergoing the same metamorphosis that other states are going through. There’s a different national-issue discussion taking place.”