Sen. Bernie Sanders (Vt.) speaks during a news conference at the U.S. Capitol on March 9. (Justin Sullivan/Getty Images)

Former Democratic Party presidential hopeful Bernie Sanders lent his star power Thursday night to ex-congressman Tom Perriello’s bid to become Virginia’s next governor, casting the state’s Democratic primary in June as part of a moral battle brewing against conservative policies championed by President Trump.

“Tom’s victory will be a signal all across this country that we will not be a nation that gives tax breaks to billionaires, that scapegoats minorities and cuts programs for working people and poor people and the sick,” the senator from Vermont told a crowd of several hundred, mostly college students, gathered inside George Mason University.

“Tom’s victory will show that America’s moral compass is pointing in a very different direction,” Sanders said.

Perriello’s populist approach in the primary race has helped his insurgent campaign gain ground on Lt. Gov. Ralph Northam — who was initially considered to have a clear path to the Democratic nomination as Gov. Terry McAuliffe’s chosen successor. One recent poll has the two Democrats locked in a tie.

Virginia Lt. Gov. Ralph Northam, left, and former Virginia congressman Tom Perriello (AP photos)

Sanders’s appearance at a rally for Perriello marked his first foray into state-level politics since Trump was elected. His decision to get involved in a primary contest between two Democrats who are largely aligned on most issues surprised some observers.

The nomination race reflects broader divisions within the Democratic Party, with the progressive wing led by Sanders pushing for a more aggressive stance on workers’ rights, the environment and other core issues to take on Trump and the Republican-controlled federal government.

Perriello has built his campaign around calls to raise the state minimum wage to $15 an hour, opposition to two natural gas pipelines in Virginia and a refusal take campaign money from utilities, namely the politically powerful Dominion Resources company.

Those positions prompted Sanders to endorse Perriello earlier this month, further raising the profile of a gubernatorial race that had already garnered national attention as an early test of how voters are responding to Trump.

At the rally, Sanders urged the cheering crowd to join the fight.

“You are going to have to roll up your sleeves, get your hands dirty and get into this fight,” he said, eliciting cheers and chants of “Bernie! Bernie!”

Sanders, who had only met Perriello in passing before Perriello reached out and sought his endorsement a few weeks ago, first spoke of him as Tom “Perielli.”

While Perriello embraced the support from Sanders, he is also trying to court moderate Democrats, mindful of the fact that Sanders lost Virginia to Hillary Clinton in last year’s presidential primary by nearly 30 points.

Perriello’s campaign points to endorsements from former aides to Barack Obama and Clinton, including Obama’s campaign manager David Plouffe and Clinton’s campaign chairman John Podesta.

“Resistance is not enough,” Perriello said at the rally. “We must continue standing for a positive vision of inclusive economic growth that leaves no race, no region and no family behind in Virginia. We can actually build a more fair economy.”

Northam’s supporters have called the progressive tone of Perriello’s campaign disingenuous, pointing to several conservative stances he took while in Congress.

They also note that the lieutenant governor has received widespread support from Virginia Democrats who they say better understand issues facing the commonwealth.

Northam is backed by nearly every Democrat in the state legislature, congressional delegation and statewide office, including McAuliffe.

As Perriello was appearing with Sanders, Northam was making phone call after phone call on behalf of Jacqueline Smith, a Democrat running for clerk of courts in Prince William County.

Still, Perriello’s rise in the polls has forced Northam into a more forceful posture.

Earlier Thursday, Northam toured the Women’s Health Clinic in Alexandria to underscore his pro-abortion-rights position.

Northam, a pediatric neurologist, has been endorsed by NARAL, the national abortion rights group as well as its Virginia affiliate. While the groups typically stay out of intraparty contests, its leaders say they want to reward Northam for his long-standing advocacy for abortion access. And they have criticized Perriello over his support while in Congress for the antiabortion Stupak amendment.

Northam used his visit to the clinic to attack Ed Gillespie, the Republican front-runner for governor, for recently saying that he would like to see abortion banned.

“Ed Gillespie should stick to what he knows best: how to navigate the D.C. swamp to help millionaires and corporations, because when it comes to women’s health, he doesn’t know what he is talking about,” Northam said, according to his campaign. “Clearly, he is emboldened by the rhetoric and actions of the Trump administration.”

The campaign for Gillespie, the former Republican National Committee chairman, has said his statement did not apply to cases of rape, incest or when a mother’s life is in danger.

Gillespie is competing in the GOP primary against state Sen. Frank W. Wagner (Virginia Beach) and Corey A. Stewart, the chairman of the Prince William Board of County Supervisors.

On Thursday, Virginia’s Republican Party sought to capitalize on Sanders’s presence in the state, predicting that his support for Perriello will backfire in the November general election.

“Tom Perriello is leading the charge, but the entire Virginia Democrat party has gone so far left that it’s out of the mainstream,” John Whitbeck, the state party chairman, said in a statement. “They seem to have forgotten that Virginia doesn’t stop at the Beltway.”

At the rally, some voters said they were energized by Sanders though still unsure about Perriello.

“There’s not much I know about Perriello,” said Sonya Boring, 36, who is pursuing a graduate degree in education at George Mason University and called herself “dejected” after Trump won the White House.

“But a lot of people are inspired that Bernie is campaigning for him,” she said. “Right now, I feel that the movement is a little defeated.”

But, she added, “I feel motivated.”