Virginia Democratic gubernatorial candidate Ralph Northam has attacked his Republican opponent, Ed Gillespie, for using "fearmongering" in his ads that target Northam's immigration policies, despite using his own tough rhetoric on illegal immigration in his past political campaigns.

Northam recently accused Gillespie—whose ads have suggested the current lieutenant governor's previously accepting position on sanctuary cities could contribute to the violent criminal gang MS-13's recruitment numbers in northern Virginia—of making "false" and "despicable" attacks.

But Northam himself has a history of using tough rhetoric against illegal immigrants during political campaigns, National Review reported.

Back in 2007, Northam ran for a seat in the Virginia state Senate, which he won, and campaigned for the position in part by opposing a policy that did not "go after" illegal immigrants.

At the time, Virginia had decided to impose elevated civil remedial fees for driving offenses—including driving 20 miles per hour over the speed limit, among others—as part of a plan to finance a $1 billion state transportation package. Northam, who was challenging two-term Republican incumbent Nick Rerras, opposed the new fees and released an ad, flagged by National Review, explaining why.

"Nick Rerras and his buddies in Richmond will say anything to stay in power," Northam says in the ad. "They're attacking me because I'm against abusive driver fees, fees that target Virginians but don't go after out-of-state drivers or illegal immigrants."

Northam's views on illegal immigration have come under fire in recent days.

After Northam said in an interview last week that he would sign a bill to ban sanctuary cities if a Virginia locality tries to become one, some left-wing groups quickly castigated the candidate. One progressive political action committee even called the Virginia Democrat's campaign "racist" for his comments, which appeared to be a flip-flop from his prior actions to stop stricter laws on illegal immigration from passing.