Jo Watts, left, jokes with Corey Stewart, then-Virginia chairman of Trump for President, as he talks with patrons prior to a Veterans for Trump dinner at L&B Pizzeria in Woodbridge in August. (Toni L. Sandys/The Washington Post)

As most of America was still absorbing the news that Donald Trump had won the presidency, Republican Corey Stewart had already declared it rocket fuel for his 2017 bid for Virginia governor.

Stewart, the one-time chairman of Trump’s Virginia campaign, said that despite the fact that Clinton beat Trump by nearly five percentage points in Virginia, Republican primary voters will reward him for being Trump’s biggest cheerleader in the state.

And he figures the Trump administration will be in accord with his stance that illegal immigrants who have committed crimes be deported.

“If you’re an illegal alien in Prince William County, I’d get out,” said Stewart, who chairs the county’s board of supervisors. “It’s the very first thing I’m going to do with a friendly Trump administration. Now we’re going to find out where each and every one of these guys is, and we’re going hunt them down and we’re going to deport them.”

“It’s a game changer,” Stewart said of Trump’s win. “It just propelled me into front-runner status for governor.”

Donald Trump’s presidential campaign fired its Virginia state co-chairman, Corey Stewart, on Oct. 10 after he took part in a protest in front of Republican National Committee headquarters. The protest drew dozens of Trump supporters. (WUSA)

It’s not at all certain that Trump’s White House victory will help Stewart in next year’s race for governor in Virginia.

Trump’s loss in Virginia could benefit Republican candidates who kept their distance from the presidential candidate. That number includes Ed Gillespie, the best known of the four who have declared so far. The others in the race are U.S. Rep. Rob Wittman and state Sen. Frank Wagner.

Virginia and New Jersey are the only states holding gubernatorial races next year. In New Jersey, where Gov. Chris Christie (R) will leave office because of term limits, the Republican brand has been tarnished by the Bridgegate scandal, analysts say.

That makes Virginia the first real test to be faced by a Republican Party in the coming Trump era. In a quandary that mirrors the national GOP’s, the state party will have to contend with a three-way fracture between the establishment wing, Trump supporters and the tea party.

One great unknown — how well Trump governs — looms over all of it. But his victory is already shaping the issues on the front burner, the candidates and the people who ultimately will turn out to vote.

Trump’s victory over Democrat Hillary Clinton means her running mate, Sen. Tim Kaine, will not vacate his Senate seat. Had Kaine become vice president, there would have been a Senate race on the ballot in 2017 to fill the remainder of his term.

Democrats — Gov. Terry McAuliffe (D) chief among them — had been counting on a Senate contest next year to energize Washington-oriented Democrats in Northern Virginia, who have helped turn the state blue for the past three presidential elections but do not turn out as faithfully during off-year elections. A Senate race would have greatly boosted prospects for Lt. Gov. Ralph Northam, so far the only Democrat running to succeed the governor, McAuliffe said.

A Senate race also could have thinned the Republican field. Wittman had mulled bowing out of the governor’s race to seek Kaine’s seat if it came open in 2017. With that opportunity gone, the field stays crowded — something that could benefit Stewart if the other three split the mainstream Republican vote.

The four GOP contenders have relationships with the president-elect that are varied and complicated, to say the least.

At one extreme is Stewart, a brasher-than-Trump figure who embraced the nominee with such abandon that the campaign ultimately gave him the heave-ho. At the other extreme, Gillespie, one-time counselor to President George W. Bush who stumped with Trump’s running mate, Indiana Gov. Mike Pence, but studiously avoided appearing with Trump. Wittman and Wagner fell between, belatedly getting on board with Trump but showing up at his rallies and lending their names to his state leadership team.

Those differences — already the source of caustic sniping not just between Stewart and Gillespie, but also between Stewart and the Trump campaign leaders who fired him — could be critical to winning over voters in the June GOP primary and the general election a year from now. Whether it pays to play up ties to Trump or keep him at arm’s length will depend in large part on how well Trump performs as president.

The fact that Republicans will choose their nominee this year in a statewide primary rather than in a closed convention should give the edge to a more moderate candidate. But the electorate that votes in off-years tends to be smaller and more conservative than in presidential contests.

“From the Democrats’ standpoint, it could wind up being a plus for the governor’s race,” said state Senate Minority Leader Richard L. Saslaw (D-Fairfax). “The president-elect has got a tendency to say things best left unsaid. That may help him with the base in middle America. But we ain’t talking anymore about Kansas or the area between Pittsburgh and Philly. We’re talking about Virginia, a state [Clinton] carried by 186,000 votes.”

But former Republican attorney general Ken Cuccinelli II, who narrowly lost the 2013 governor’s race to McAuliffe, said Trump’s national victory will make it hard for Democrats to demonize his supporters. “Certainly the Democrats are gearing up to try to wrap him around Republicans’ necks as a huge negative,” he said. “That looks pretty dubious today.”

In fact, when Wagner formally launched his bid for governor Wednesday, he promoted himself as “statewide Trump campaign co-chairman.” He was one of 17 co-chairmen, as was Wittman.

Wittman and Gillespie walked a finer line. After winning reelection to Congress on Tuesday, Wittman issued a statement that did not mention Trump by name. “The Congressman is excited about Republican victories across the board,” said Wittman’s political director, Garrison Coward.

As the election results rolled in Tuesday night, Gillespie was at a victory party for his friend Republican Rep. Barbara Comstock, where he watched Trump’s improbable rise flash across his Twitter feed.

Asked about the impact of Trump on the Virginia governor’s race, Gillespie said he was focused on his own campaign.

“I’m running for the Republican nomination for governor on my ideas, my plans, on what I believe we need to do,” he said. “I’ll put it forward, and I’ll let the voters decide.”

Trump’s victory exposed the extent of the discontent among many, Gillespie said.

“I think it shows you that there are a lot of voters out there who are very concerned about being left behind in this economy, the frustration over stagnant wages and the economy,” he said.

Gillespie, who came close to toppling Sen. Mark R. Warner in 2014, has positioned himself as someone who can unite a splintered GOP and appeal to swing voters. During and after his Senate bid, he courted tea party activists as well as the GOP establishment, racking up campaign donations and endorsements.

Stewart contends that Gillespie will pay for keeping his distance from the nominee. “Ed Gillespie treated Donald Trump like he had typhoid,” Stewart said.

During the campaign, Stewart positioned himself as more Trump than Trump himself. Critics, including some inside the Trump campaign, accused Stewart of grandstanding.

In July, when Stewart blamed Clinton and Northam for a Dallas police massacre, the campaign disavowed his comments. In October, it fired him for participating in a protest outside of Republican National Committee headquarters and accusing “establishment pukes” of starving the Virginia campaign of resources.

[Trump’s Virginia chairman blames Clinton, Northam for Dallas massacre]

Stewart never blamed Trump for his firing, saying it was the work of the RNC. He wore his ouster as a badge of honor, using it as the basis of a fundraising appeal for his anti-establishment campaign.

[You’re fired: Trump campaign dumps Virginia state chair Corey Stewart]

Mike Rubino, Trump’s senior Virginia adviser, said Stewart should not expect support from the president-elect.

“To be honest, Mr. Trump doesn’t even know who Corey Stewart is,” Rubino said. “He went rogue. He never followed orders. He never did what the campaign asked him to do. He was so preoccupied with running for governor that we had to fire him. . . . This guy was a cancer to the organization in Virginia, and we’ve been paying for it ever since.”

[Trump’s Virginia chair: Trump ‘acted like a frat boy, as a lot of guys do’]

Stewart said he was floored by Rubino’s criticism, which he chalked up to finger-pointing over Trump’s loss in Virginia, the only Southern state that went blue.

“I worked my tail off” for Trump, he said. “If he’s looking for a scapegoat, he should look at the establishment that sat on their haunches and diverted [resources] away from Virginia.”

John Fredericks, the conservative radio host who became chairman of Trump’s Virginia campaign after Stewart’s ouster, said Stewart and Gillespie will have to repair their relationships with Trump voters.

And for that reason, he said, “This is a wide-open race.”

Jenna Portnoy contributed to this report.