The campaign for Republican Virginia gubernatorial candidate Ed Gillespie released an ad attacking Democratic opponent Lt. Gov. Ralph Northam on immigration. (Ed Gillespie for Virginia Governor 2017)

Virginia Republican Ed Gillespie has released four ads that try to tie his Democratic rival for governor, Ralph Northam, to MS-13 gang violence, despite protests from Democrats and Latino groups that the commercials play on racial stereotypes.

The latest ad, which started airing this week in the Roanoke market, begins with a dark, hooded figure in a home holding up a baseball bat as the MS-13 motto “Kill, Rape, Control” flashes on the screen. Then, a narrator warns of violent crime linked to the street gang in Virginia — and accuses Northam of putting Virginia families at risk.

“Northam cast the deciding vote in favor of sanctuary cities that let illegal immigrants who commit crimes back on the street, increasing the threat of MS-13,” the narrator says — a claim that the nonpartisan FactCheck.org calls “misleading.”

The new ad echoes a similar commercial aired last week by the Gillespie campaign that interspersed images of Northam with the MS-13 motto and tattooed faces of men who, as it turns out, were not MS-13 members and were photographed in a prison in El Salvador.

Republican gubernatorial candidate Ed Gillespie, left, and his Democratic opponent, Lt. Gov. Ralph Northam, debate on Sept. 19 in McLean. (Bill O’Leary/The Washington Post)

That commercial, which launched in the television markets serving Charlottesville and Southside and southwestern Virginia, has expanded to urban areas including Richmond and the D.C. market that includes Northern Virginia.

The MS-13 ads mark a shift in the tone of the Virginia governor’s race, which is the nation’s marquee statewide contest this year and had been applauded by observers for its relative civility.

Bob Holsworth, a former Virginia Commonwealth University political scientist, said the ads seem intended to grab the attention of voters and give them a compelling reason to go to the polls.

“This is going back to an old-line Republican message that Democrats’ policies are making the streets less safe,” he said. “Whether it’s something that’s going to motivate voters — the polls don’t seem to show that public safety is a critical issue in this race. But I think there’s some belief in the Gillespie campaign that in a low-turnout election, this can motivate voters.”

The ads sparked a firestorm of criticism from Democrats, who accused Gillespie of playing on fears of Latinos. They likened the commercial to the “Willie Horton” ad used against Democrat Michael Dukakis in the 1988 presidential race that focused on an African American felon who committed crimes while out on a weekend furlough program in Massachusetts. The commercial was damaging to Dukakis, the governor of Massachusetts at the time of Horton’s release. Critics said the ad preyed on public fears of black criminals.

Gillespie’s commercials have attracted national notice. Fox News host Tucker Carlson aired a segment on one of the ads this week, sparring with Latino Victory Fund President Cristóbal J. Alex.

The latest stories and details on the 2017 Virginia general election and race for governor.

Carlson said that members of MS-13 are often undocumented immigrants and that “sanctuary cities” offer them shelter. Alex said the ad falsely equates undocumented immigrants with gang members and is part of a broader Republican effort to turn MS-13 into a “Latino boogeyman.”

Ben Marchi, a longtime Republican operative from Culpeper, said the strategy is a smart attempt to attract suburban swing voters, especially in places such as Prince William and Loudoun counties, where gang violence is a problem.

“It’s a great ad,” he said of the first spot. “That is the message that Virginians do care about. They want to know they’re safe, and right now there’s a problem with violent illegal aliens.”

While Gillespie’s campaign normally rolls out new commercials with news releases and social media blasts, it did not take similar steps for the MS-13 commercials.

Gillespie declined to comment about the ads after his appearance Thursday at a Richmond forum, directing questions to spokesman David Abrams.

Abrams said via text, “As extensively reported by The Washington Post, MS-13 is a growing problem in Virginia. Allowing for the establishment of sanctuary cities in Virginia as . . . Northam has voted for will not help us solve the problem or make us safer. Ed opposes sanctuary cities, and he has put forward a substantive detailed plan to keep Virginians safe.”

Northam, appearing at the same forum, called the ad “unfortunate.”

“My father was a judge. My grandfather was a judge,” he said, noting that the Virginia Sheriffs’ Association applauded him as legislator of the year in 2011. “For someone to say that I’m soft on crime or want to release convicted felons, that’s shortsighted.”

Northam has said that anyone who commits a violent crime should be prosecuted, regardless of immigration status.

Virginia is among the states that have seen a resurgence of MS-13 activity driven in part by the recent influx of unaccompanied teenage immigrants, according to a Washington Post investigation cited in Gillespie’s campaign commercials.

Authorities say MS-13 is behind the recent deaths of a 15-year-old girl in Springfield, a 21-year-old man in Dumfries and a 25-year-old man outside a bar in Manassas, among others.

Northam, the state’s lieutenant governor, did cast a tiebreaking vote in February against a GOP bill that would have banned “sanctuary cities,” localities that choose not to cooperate with federal immigration authorities.

But the bill ultimately passed the state Senate, so Northam did not cast the deciding vote. It was later vetoed by Gov. Terry McAuliffe (D).

Meanwhile, Virginia has no such localities, a fact that Gillespie has acknowledged but that is omitted from his ads.

Virginia voters will choose a new governor on Nov. 7.