Candidates are spending the final days of the gubernatorial races in Virginia and New Jersey battling over illegal immigration and sanctuary cities as voters head to the polls Tuesday.

In both contests, Republicans and Democrats have recently hit each other over immigration-related issues, including sanctuary cities, where local policies protect illegal immigrants from federal deportation.

In Virginia, the race between Republican nominee Ed Gillespie and Democratic nominee Ralph Northam has gotten particularly nasty in recent weeks, with each side accusing the other of running ads that are out of line.

Earlier this week, a liberal group called the Latino Victory Fund released a television ad showing immigrant and minority children in Virginia being chased down the road by a man in a pickup truck with a Confederate flag and a Gillespie bumper sticker.

The group eventually took the ad down after the terrorist attack in New York, where eight people were killed when a man intentionally mowed them down in a truck.

“Virginians respect and appreciate civil discourse, but the Latino Victory Fund’s ad was far out of bounds of the civility Virginians expect and deserve,” Gillespie campaign manager Chris Leavitt said.

Meanwhile, Democrats have protested ads from Gillespie accusing Northam of voting for bills that would lead to sanctuary cities and a threat increase from the MS-13 gang.

Northam’s campaign has accused Gillespie, a former chairman of the Republican National Committee, of being a “mini-Trump” whose ads “demonize” immigrants.

WHITE HOUSE SLAMS DEMOCRATIC AD IN VIRGINIA WHERE MAN IN TRUCK CHASES MINORITY CHILDREN

“From his toxic ads to his embrace of Trumpcare, Ed Gillespie has transformed himself into Virginia’s very own mini-Trump,” Northam spokesman David Turner said.

As Gillespie has embraced illegal immigration as a campaign issue, President Trump has tweeted his support for Gillespie in the race.

“Ralph Northam, who is running for Governor of Virginia, is fighting for the violent MS-13 killer gangs & sanctuary cities,” the president tweeted last month. “Vote Ed Gillespie!”

Yet in New Jersey, Trump has not spoken out in support of Republican Lt. Gov. Kim Guadagno, who is running against Democratic nominee Phil Murphy.

Guadagno has spent the campaign railing against sanctuary cities, releasing an ad drawing attention to Murphy’s debate comments in support of New Jersey being a “sanctuary state” and telling the story of an illegal immigrant who was convicted of killing several students in 2007.

“Murphy doesn’t have our backs,” the ad’s narrator says. Referencing criminal illegal immigrants, the narrator continues: “He has theirs.”

Like Northam in Virginia, Murphy has responded by accusing Guadagno of taking a page from Trump with her emphasis on the issue.

“Kim Guadagno should be ashamed of herself for the way she’s politicizing the deaths of three children and painting a community with the broad brush of a murderer, a tactic she must have gleaned from President Trump,” Murphy said in response to the ad. “To say the least, these are not New Jersey’s values.”

In both states, the candidates are battling to succeed two well-known governors, Republican Chris Christie of New Jersey and Democrat Terry McAuliffe of Virginia.

Heading into Tuesday’s vote, Democrats have the advantage, according to recent polling. The Real Clear Politics polling average has Northam leading Gillespie by 3 points in Virginia; in New Jersey, the polling average has Murphy ahead of Guadagno by 15 points.