Democrat Lt. Gov. Ralph Northam, left, and Republican Ed Gillespie are competing in Virginia’s closely watched race for governor. Both have migrated to positions out of step with their past records. (Bob Brown/Richmond Times-Dispatch/AP)

Labor Day weekend traditionally kicks off high season for the Virginia governor’s race, but tradition is under siege this year, and both major-party candidates have already been taking shots at each other.

The heightened political environment of the Trump administration, supercharged by the racial violence in Charlottesville, finds Republican Ed Gillespie and Democrat Ralph Northam in full battle mode.

Pushed by the same political divisions that are rending the nation, both men have taken positions that stray from their records.

Gillespie, long a proponent of a comprehensive immigration overhaul, is talking about the need to protect communities from dangerous undocumented criminals.

Democratic gubernatorial candidate Lt. Gov. Ralph Northam, left, speaks with Suha Chandler, of Fairfax, Va., after worship services at the Dar Alnoor Islamic Community Center in Manassas, Va., Friday, Sept. 1, 2017. While Labor Day is the traditional kickoff for campaign season, the race for governor is already in high gear. (Steve Helber/AP)

Northam, the lieutenant governor and legislator who built a reputation as an aw-shucks Southern gentleman, now says the president of the United States is dangerous and possibly mentally ill.

And the pair find themselves in the middle of a heated war over Confederate statues, with Gillespie urged by his base to defend them and Northam by his to call for their removal.

David Ramadan, a former ­Republican delegate from Northern Virginia, faults both sides for heeding the advice of political strategists that in a low-turnout, off-year election they must play to the extremes.

“Both sides are playing with fire,” he said. “Political strategists are counting on you not voting. . . . So Democrats are headed back to the far left and Republicans are headed to the far right. It’s a shame.”

In a sense, neither candidate can quite shed the ghost of his primary opponent. Republican Corey Stewart nearly took the nomination from Gillespie by stirring up the right wing of the party, and Democrat Tom Perriello drew big national dollars in his challenge to Northam by running hard against President Trump.

It wasn’t supposed to be that way this year. Virginia’s last gubernatorial race, between Democrat Terry McAuliffe and Republican Ken Cuccinelli, was ideologically polarized in a way that seemed unusual for the state. McAuliffe, who won, was the glad-handing soul mate of former president Bill Clinton running against a thunderously conservative Cuccinelli.

The parties seemed to gravitate back toward middle ground with their presumed nominees for 2017 — Northam and Gillespie were both centrists with vanilla personalities.

But after Trump’s surprising election, and the unexpectedly hard-fought primary races this spring, the landscape has changed.

“In this political climate right now, there’s not much room for moderation,” said Del. Marcus B. Simon (D-Fairfax).

That was illustrated dramatically after last month’s violent clash in Charlottesville between white supremacists and counterprotesters around a statue of Confederate Gen. Robert E. Lee. As the nation debated what to do about Confederate statues, Northam surprised even some fellow Democrats by coming out forcefully in favor of moving public monuments into museums.

Although Northam also says localities should decide the issue for themselves, his posture is a tricky one in Virginia, which has more Civil War monuments than any other state and where polls show a slim majority of residents want the statues to remain in place.

“He probably got out farther than he would have if Charlottesville hadn’t happened,” said state Sen. Barbara A. Favola (D-Arlington). “But I think Charlottesville moved a large number of people who at one point were in the middle.”

Gillespie also found himself on dangerous terrain when Trump drew widespread anger by initially saying the violence in Charlottesville could be blamed on “many sides” instead of condemning the white supremacists.

Northam pushed his opponent to disavow Trump’s comments, but Gillespie — who last year was slow to embrace Trump’s candidacy — has generally avoided mentioning the president. He has denounced white supremacists but defended the statues and thinks they should stay put.

In the weeks since, Gillespie went on the offensive and aired the first attack ad of the campaign, slamming Northam for allegedly supporting “sanctuary cities” that allow undocumented immigrants who have committed crimes to take refuge from federal agents. There’s a complicated backstory there — Virginia has no sanctuary cities, but Republicans in the state Senate used a parliamentary maneuver to get Northam to cast a vote on the topic.

The result is that as September begins, Northam is suggesting that Gillespie won’t disavow racists, while Gillespie hints that Northam coddles undocumented immigrants.

“It has been a little more negative before Labor Day than I would have expected,” said Del. David J. Toscano (D-Charlottesville), the House minority leader. He blamed the negative turn on “Republicans’ concern about the state of the race,” but others say the tone of the race flows directly out of Washington.

Many people bemoan the polarization and speak wistfully of the bygone — if not entirely imagined — era of collegial bipartisanship known as “the Virginia way.”

John Fredericks is not among them.

The conservative radio host, who helped lead Trump’s Virginia campaign, wants Gillespie move closer to the president in substance and style. Gillespie recently hired the blunt-spoken operative who helped Trump round up votes in Southwest Virginia, a man who contends on Facebook that communists are behind the push to remove Confederate statues.

Fredericks thinks monuments could be the issue that puts Gillespie over the top.

“I think it’s a winning issue for him,” Fredericks said. “We’ve teed it up. He just has to hit the ball and leave nothing for interpretation or ambiguity.”

Democrats didn’t anticipate Confederate monuments as a lasting issue in this year’s governor’s race. Northam now says he thinks the topic will linger into the fall, and he’s trying to steer the conversation to other issues.

“There are a lot more monuments we need to discuss in Virginia that aren’t built in bronze, and those are the inequities we have, such as inequities in income . . . in access to education, in access to health care and voting rights,” Northam said in an interview.

Those roads lead, inevitably, back to Trump.

“I think that there are policies that are coming out of Washington right now that are very detrimental to Virginia, and people are certainly paying attention to those,” Northam said, mentioning Trump’s positions on health care, his proposed Muslim travel ban, on climate change.

“I look at my opponent — this is a time for leadership and to stand up and say, ‘These policies coming out of Washington are detrimental to Virginia and I’m going to stand up against them,’ ” Northam said.

Gillespie’s campaign said he was unavailable for an interview but others in the party voiced exasperation that everything Gillespie proposes gets viewed through the lens of Trump.

For instance, Gillespie’s call for aggressive action against MS-13, a violent street gang that has taken root in some immigrant communities, fits neatly in the long history of GOP law-and-order gubernatorial candidates. But in the current climate, it is portrayed as an extension of Trump’s “build that wall”approach. Former state attorney general Jerry Kilgore, finance chairman for the state GOP, said he thinks Gillespie’s stance will play well in suburbs and rural areas — “in spite of the head winds coming from Washington.”

But insiders on both sides worry about the tone of the race. Gillespie and Northam have already begun their TV advertising, and both will have significant financial resources as national attention focuses on Virginia’s race — the marquee statewide contest this year.

If the tone is already sharp by Labor Day, it could get worse.

“I think many folks would agree that Washington has kind of helped to throw gasoline on the fire, and it’s a difficult environment to govern with so many emotions running high,” said Del. Sam Rasoul (D-Roanoke), the General Assembly’s only Muslim, who has called for more unity and understanding.

Ramadan, the former Republican delegate, said he still supports Gillespie but regrets the way the race is developing. “I am fed up and I am disappointed in both of them for turning this into what Virginia is not,” he said.