Gubernatorial candidates Ed Gillespie and Lt. Gov. Ralph Northam joke during a commercial break for their debate in Washington on Sept. 19. (Bonnie Jo Mount/Washington Post)

President Trump looms large over the race for Virginia governor, according to a new survey that finds the president is a factor for a sizable slice of the electorate.

For nearly 40 percent of voters, Trump plays into the choice between Democrat Ralph Northam and Republican Ed Gillespie, according to a poll released Tuesday by the Wason Center for Public Policy at Christopher Newport University. For 28 percent of voters, the president is a major factor.

The "Trump effect" is more pronounced among Northam voters, who are much more likely to disapprove of the president and to say their vote is meant to send a message to Trump and congressional Republicans.

"Disapproval of Trump and Congress is clearly motivating Northam's voters," said Rachel Bitecofer, assistant director of the Wason Center. "Gillespie voters mostly support Trump, but they'd rather keep him out of the picture here."

Trump has a 35 percent overall approval rating in the commonwealth, but Northam and Gillespie supporters have sharply different assessments of him. Northam voters almost universally take a dim view of the president, with 96 percent disapproving of his job performance. Gillespie voters are split, with 75 percent approving of Trump and 16 percent disapproving.

A 51 percent majority of Northam voters say Trump plays into their choice for governor, while 72 percent of Gillespie voters say he does not. Among independents, 78 percent say the president is not a factor.

Nearly half of all voters, 49 percent, consider their vote a way to send a message to Trump and the Republican-controlled Congress. About one-third say they want their vote to convey a message of disapproval, while 19 percent say it should be seen as a sign of support.

Northam, the state's lieutenant governor, is a pediatric neurologist who earned a reputation for working across the aisle as a two-term state senator. While touting his bipartisan credentials in this race, he has used uncharacteristically sharp rhetoric against Trump, calling the president a "narcissistic maniac" in a TV ad.

Gillespie, an establishment figure who nearly unseated Sen. Mark R. Warner (D) in 2014, has walked a fine line with Trump, whom he supported only grudgingly after the real estate developer and reality TV personality locked up the GOP presidential nomination last year. Gillespie — a former lobbyist and Republican political operative who served as a counselor to President George W. Bush and as chairman of the National Republican Committee — has avoided appearing with Trump and commenting on his presidency.

Virginia general election guide

But Gillespie also has taken steps to court Trump voters since nearly losing the June GOP primary to Corey Stewart, the president's one-time Virginia campaign chairman who made the defense of Virginia's Confederate monuments the cornerstone of his populist campaign. Gillespie has used images of a massive border wall and handcuffed undocumented immigrants in some ads. And he has hired a veteran of the Trump and Stewart campaigns, who warns that communists are behind the push to remove monuments, as his field director for Southwest Virginia.

The poll explores the monuments issue, which gained prominence in the governor's race in August, when a white supremacist rally in Charlottesville dissolved into violence and mayhem and left three people dead. The rally had been called to protest the city council's plan to remove a statue of the Confederate general Robert E. Lee from a downtown park.

Northam and Gillespie have done some fancy footwork around the issue, which presents risks for them. Both agree that the governor does not have much power to remove monuments. Cities have jurisdiction over their own statues in most cases. The governor would have some say over state-owned statues, such as the one of Lee on Richmond's Monument Avenue, but the legislature would have to approve a removal. The governor eventually would have a say over Confederate monuments at Virginia Military Institute, through his appointments to the school's board of governors. Northam attended VMI.

Before the rally, Northam and Gillespie seemed content to say the issue was out of their hands, though Northam said he would prefer to see statues moved to museums and Gillespie said he would prefer to have them stay put.

Northam took a harder line after Charlottesville, pledging to be a "vocal advocate" for removal. More recently, as estimates for relocating the Monument Avenue statues hit $5 million to $10 million, Northam has spoken of the need to address other "monuments" to racism, such as inequities in education and health care. Gillespie, while calling for "a conversation" about the monuments in an essay released after the rally, has since said the monuments should remain in place but with added historical context.

The poll found that there could be a "Robert E. Lee effect" at work in the race, with 54 percent of voters opposed to removing monuments from public spaces. Sixty-two percent of Northam voters support removal, while 86 percent of Gillespie voters oppose it.

Nearly 75 percent of Gillespie voters say the monuments symbolize Southern pride, as do 26 percent of Northam voters. Among the Democrat's supporters, 59 percent say the statues symbolize racism.

"It's clear this is a more complicated issue for Northam than for Gillespie," said Quentin Kidd, director of the Wason Center. "Gillespie appears to have a Donald Trump problem, but Northam may have a Robert E. Lee problem."

The poll also finds that 44 percent of voters say Virginia is moving in the right direction and that 51 percent approve of the job that Gov. Terry McAuliffe (D) is doing. McAuliffe is prohibited by the state Constitution from seeking back-to-back terms.

The poll, which has a margin of error of plus or minus 3.7 percentage points, was released the day after another Wason Center survey found Northam leading Gillespie, 47 percent to 41 percent. Libertarian Cliff Hyra claimed 4 percent of the vote and 8 percent of voters were undecided.

Another poll released Tuesday, from Monmouth University, gives Northam a five-point lead over Gillespie, with the lieutenant governor gaining support in the normally red-leaning western half of the state.

In the Monmouth poll, 49 percent of voters back Northam, 44 percent support Gillespie, 2 percent support Hyra and 4 percent are undecided. Two months ago, Monmouth had the major party candidates tied at 44 percent, with Hyra at 3 percent and 9 percent undecided.

While maintaining a hefty 17-point lead in Northern Virginia and 9-point lead in the eastern part of the state, Northam has cut into Gillespie's margins in the western half over the past two months, according to the poll, which has a margin of error of plus or minus 4.4 percentage points. The 18-point advantage that Gillespie enjoyed there in July has dwindled to a 7-point lead.

"The fact that Republicans once courted Northam to switch to their party probably doesn't hurt his credibility with that electorate," said Patrick Murray, director of Monmouth University Polling Institute.

The CNU and Monmouth surveys are the latest in a series of polls to find Northam with a slight lead or in dead heat with Gillespie ahead of the Nov. 7 contest.