When Virginia elected L. Douglas Wilder as the first black governor in the country nearly 30 years ago, many heralded a new chapter in a state with a painful racial past.

"The day of extreme racism may be over," Ernest Miller, an African-American educator from Farmville, told a reporter at Wilder's election night victory party in Richmond.

Now retired and unhappy with President Donald Trump as well as the tone of the current governor's race, Miller said racism "seems to be coming more alive."

"Back then I had more hope," Miller said.

The contest between Republican Ed Gillespie and Democrat Ralph Northam has become one of Virginia's most racially charged campaigns in memory, observers say. Shaped by Trump's moves to crack down on immigration and this summer's deadly white nationalist rally over Confederate monuments in Charlottesville, it has involved bare-knuckled, personal attacks involving race by both the candidates as well as their allies.

And Election Tuesday's outcome is likely to hinge on minority turnout.

"Here you have two relatively bland, unexciting candidates running these brutal, negative attack ads," said longtime political observer Bob Holsworth. "It's almost as if both campaigns are very worried their base won't turn out, so they're going to work to terrify them."

Gillespie has made campaign bedrocks of preserving Confederate statues and enacting tougher policies toward Virginia's undocumented immigrants. He's spent millions on hard-edged ads, including some accusing Northam of being "weak" on the Hispanic gang MS-13 - which critics called race-baiting.

A Gillespie mailer called undocumented immigrants "illegals," a pejorative term his campaign later disavowed. And the state party had to apologize after tweeting that Northam - because an ancestor may have fought in the Civil War - "turned his back on his own family's heritage" by favoring the statues' removal.

Gillespie's campaign also has run ads trying to link Northam to sex offenders for supporting automatic rights restoration of felons who have served their time. The new policy of automatic restoration of voting and other rights, enacted by term-limited Gov. Terry McAuliffe, was designed to end decades of black disenfranchisement.

Gabriel Schonfeld, who worked with Gillespie on Mitt Romney's 2012 presidential run, is one of several conservatives publicly blasting Gillespie's campaign strategy.

"A great guy, now covering himself in filth," Schonfeld said on Twitter.

Northam's TV attacks on Gillespie have focused more on his lobbying career than racial issues, but a Northam mailer lumped Gillespie in with the torch-wielding white supremacists at Charlottesville, saying Election Day was a chance to "stand up to hate."

The Latino Victory Fund, a group backing Northam that's funded partly by mega-donor George Soros, called Trump and Gillespie "two racist peas in a pod'' in one ad. Another shows a Gillespie supporter chasing down children of different minority groups in a pickup truck.

"The only people I see stoking political racism right now are the people in the groups that are running ads like the one you saw take place in Virginia," White House spokeswoman Sarah Huckabee Sanders said Tuesday.

The truck ad was pulled after an Uzbek immigrant was arrested and accused of using a truck to kill eight people in Manhattan.

Neither Gillespie nor Northam has backed down from their or their allies ads.

Racial politics once took center stage in Virginia, home of the former Confederate capital and hub of a past segregationist movement known as Massive Resistance. But recent decades have seen Virginia turn more cosmopolitan and liberal.

Democrats control all statewide seats and have won three of the last four gubernatorial contests. Virginia was the only Southern state Trump didn't win last year. And voter-rich northern Virginia, where Democrats frequently run up insurmountable totals, is one of the nation's most ethnically diverse areas. Strong black support in urban areas is another reason for the Democrats' success.

Against those headwinds, Gillespie has worked to develop ties with Northern Virginia's various ethnic groups, and he proposed criminal justice reforms he said would help the African-American community. As a former Republican National Committee chairman, Gillespie also has advocated for a more welcoming GOP for years.

But critics say Gillespie has undercut those efforts as the broader population sees campaign ads targeted at white Trump voters.

"You cannot say one thing and do another," said Miller, a past president of the state NAACP chapter.

Northam is facing headwinds of his own. Minority voters historically turn out in lower numbers in off-year state-level elections, and in last year's presidential election, voter turnout in mostly black precincts dropped 8 percent compared to when President Barack Obama was running in 2008 and 2012, according to the Virginia Public Access Project.

Northam is keenly focused on courting black voters, with frequent campaign stops at African-American churches and seven-figure spending on outreach efforts. And all of Northam's high-profile campaign surrogates from out-of-state have been black, including Obama, former Attorney General Eric Holder Jr. and U.S. Sen. Kamala Harris.

Harris, who stumped last weekend for Northam, said reaching diverse communities is crucial in the Trump era and she's heartened by the enthusiasm she's seeing in Virginia.