If Democrat Tom Perriello gets his way, this year’s gubernatorial race in Virginia will send a message to President Donald Trump and the state’s Democratic establishment — as well as possibly change Virginia’s politics for a generation.

But some formidable obstacles stand in his way, including the state’s Democratic lieutenant governor who has been the party’s heir apparent for the job, and the likely Republican nominee who might be difficult to tie to Trump in a general election.

Perriello — a former congressman who was elected in 2008, championed Barack Obama’s health-care law and then narrowly lost his conservative-leaning seat in the 2010 Tea Party wave — is now running for governor in arguably the marquee race in 2017.

And he sees the contest as a referendum on Trump, who lost the state to Hillary Clinton in the 2016 general election by a 50 percent-to-44 percent margin. Just 38 percent of Virginia voters approve of Trump’s job performance, according to a recent Quinnipiac poll.

“I think it’s actually accurate to say this is the first test case of elections in the Trump Era,” Perriello said in an interview with NBC News. (Since the days of Jimmy Carter, the party controlling the White House has always lost Virginia’s gubernatorial contest, but with one recent exception — Democrat Terry McAuliffe’s victory in 2013.)

“People definitely want to hear our plan for Virginia and how we’re going to build inclusive economic growth across the entire state,” he said, acknowledging that a governor’s job isn’t to always react to national news. “And at the same time, I think what people want to know about right now is people’s positions on Trump.”

“If you’re from an ethnic community in Northern Virginia, then Trump is a very local issue,” Perriello added. “People in the African-American community are incredibly concerned about the shift from [Obama Attorney General] Loretta Lynch to [Trump Attorney General] Jeff Sessions… They know that Virginia rejected these kinds of policies. And they want to see a governor who makes sure they are protected.”

But before he takes on Trump, Perriello is challenging Virginia’s Democratic establishment by running in a primary for the Democratic gubernatorial nomination against Lt. Gov. Ralph Northam, who has been endorsed by Democratic Gov. McAuliffe, as well as the state’s two Democratic U.S. senators, Tim Kaine and Mark Warner.

Perriello’s entry in the race blindsided Virginia Democrats, who were already eyeing a general election against Republican Ed Gillespie, the frontrunner for the GOP nomination who narrowly lost to Warner in 2014.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

“They wanted to start taking on Gillespie right now,” says Jennifer Duffy, who monitors gubernatorial races for the nonpartisan Cook Political Report. “This is not how they wanted to spend their time or resources.”

But Mo Elleithee, a Democratic strategist who’s worked on statewide Virginia contests and is the founding executive director of Georgetown University’s Institute of Politics and Public Service, believes a competitive primary will make the winner stronger.

Democratic candidate for governor of Virginia, former congressman Tom Perriello Steve Helber / AP

“If Northam wins, he ought to thank Tom Perriello for getting in the race. Having a competitive Democratic primary will actually help,” Elleithee said.

Calling himself a "pragmatic populist," Perriello, 42, subscribes to a brasher brand of politics that he says combines the political attitudes of Hillary Clinton, Bernie Sanders and Barack Obama. This is the best way to inspire Democrats to the polls in an off-year election in a state right next to the White House, he said.

“Our team is actually 50 percent Bernie people, 50 percent Hillary people and 100 percent Obama people,” Perriello says of his campaign staff. “I think Hillary Clinton’s nose-to-the-grindstone-wonkish-results-oriented approach is something I’d love to emulate, and Bernie’s ability to speak to the fact that the system has been really rigged against everyday folks is also an important piece of that.”

He adds that the Democratic establishment being behind Northam benefits his campaign. “Sometimes it feels like they are handing me a gift,” he says. “I think there is an appeal among voters for someone who comes from outside the system.”

And Perriello argues that this kind of politics — as opposed to Northam’s more low-key approach — gives Democrats a better chance in 2017.

“We believe our campaign presents a much better chance for Democrats to hold Virginia, and it’s crucial this year because this governor will oversee redistricting [and] have a chance for a level playing field that can redefine Virginia politics for a generation,” Perriello added.

But Northam’s campaign counters that Perriello won’t have a monopoly when it comes to criticizing Trump; they will be engaged in it, too. “No Democrat is going to be more anti-Trump in this race,” said Northam campaign spokesman David Turner.

And the Northam camp contends that the lieutenant governor’s own progressive record in Virginia – which includes fighting the transvaginal ultrasound legislation in 2012 and pushing for gun-safety reforms – and his background in the rural part of the state make him someone “who can talk to any part of Virginia,” Turner adds.

In addition, critics have questioned Perriello’s progressive credentials by highlighting his A-rating from the National Rifle Association when he was a member of Congress, as well as his vote for an anti-abortion-related amendment to Obama’s health-care law.

And then there was Perriello recently going too far in criticizing Trump by comparing the president’s win in the 2016 general election to the 9/11 terrorist attacks.

“The election of Donald Trump was a little bit like, you know, a political and constitutional September 11 for us, if I can be honest,” he said.

Perriello apologized for the remark, but Northam jumped all over it. “Those are certainly not the words I would use, and I think the analogy is awful and offensive,” Northam said in a statement.

As for Republicans, they argue that it’s too soon to conclude that Virginia’s gubernatorial race will be a referendum on Trump. “I think it’s way too early to tell if this is going to be a referendum on Donald Trump, or what is going to shape the Virginia governor race,” said Jon Thompson, communications director at the Republican Governors Association. He added that the Perriello-vs.-Northam primary will push the Democratic Party to the left.

“Perriello and Northam are in a race to the left,” Thompson said. “They are betting that Virginia is a blue state, but it’s purple.”

And Republicans point out that GOP front-runner Gillespie — who served in the George W. Bush White House, was Republican National Committee chairman and was a prominent lobbyist — will be difficult to link to Trump, at least temperamentally.

But Perriello says that for Virginia Democrats, who were expecting Hillary Clinton to be in the White House and not Trump, it’s time to rip up the playbook — and make the race a lot more about Trump.

“There is unprecedented energy in the Democratic Party, which we are pleased to see,” he said. “But there is even more energy in the movements and civic organizations in every town we got to.”

And he adds, jokingly, “The main thing I hear from voters across Virginia is, ‘There’s another election already?’”