Republican Ed Gillespie has vaulted into the lead in the Virginia governor’s race even as he sought to tie his rival to Democrat-supported sanctuary city policies, possibly offering a window into GOP strategy in the 2018 midterm elections.

Gillespie’s efforts to link Democratic rival Ralph Northam, the state’s lieutenant governor, to sanctuary cites is part of Gillespie’s large effort to portray Northam as soft on crime. He has made the case in debates and a barrage of TV ads that the policy of protecting illegal immigrants from federal immigration officials has helped spur the rise of the violent Central American gang MS-13.

"MS-13 is a menace, yet Ralph Northam voted in favor of sanctuary cities that let dangerous illegal immigrants back on the street, increasing the threat of MS-13," the narrator says in one ad.

"Republicans have figured out how to use the sanctuary city issue to bring together fears about crime and smash it together with immigration in a way that's really not helpful for Democrats." — Lanae Erickson Hatalsky, of Third Way

Sanctuary city policies essentially protect illegal immigrants from federal deportation by barring local law enforcement authorities from notifying federal officials when they come across an illegal immigrant. The Gillespie ad refers to a Virginia bill that tried to prevent local jurisdictions from adopting such policies but never became law.

Given Gillespie's rise in the polls, it has been shown to be a potent issue for Republicans in one of the nation's key "purple" states.

"Republicans have figured out how to use the sanctuary city issue to bring together fears about crime and smash it together with immigration in a way that's really not helpful for Democrats," Lanae Erickson Hatalsky, of Third Way, a centrist Democratic think tank, told The Wall Street Journal.

Northam led by 7 percentage points just several weeks ago, but Gillespie now leads by 2 points, according to the most recent RealClearPolitics polls.

Virginia has elected a Republican governor only once in roughly the past 15 years, and it was the only southern state that Democratic presidential nominee Hillary Clinton won last year. The election takes place on Nov. 7.

The Northam campaign has used its own TV ads to fight back against Gillespie’s efforts to tie its candidate to violent Latino gangs like MS-13 and sanctuary cities, saying the connection is “not true.”

A campaign official told The Wall Street Journal that the attacks are backfiring on Gillespie because they are so "over the top" and false.