Virginia Democratic gubernatorial primary candidate Tom Perriello visiting a mosque in Sterling, Va. on March 17, 2017. (Linda Davidson/The Washington Post)

Sen. Bernie Sanders, who has emerged as a leader of the Democratic Party’s progressive wing after his unsuccessful presidential campaign, has endorsed former congressman Tom Perriello in the Virginia governor’s race.

Perriello is competing for the Democratic nomination in the June 13 primary against Lt. Gov. Ralph Northam, who is backed by nearly every Democrat in the state legislature, congressional delegation and statewide office.

“We need to elect progressives at every level of government if we are going to beat back the dangerous agenda of the Trump Administration and its Republican allies,” Sanders said in a statement Tuesday. “Tom is committed to fighting the rigged economy and income inequality. He was the first major statewide candidate in Virginia to run on a $15 minimum wage and the first to say two years of community college should be tuition-free.”

Sanders (I-Vt.), who caucuses with the Senate Democrats, is the first national figure to endorse Perriello. In the Super Tuesday presidential primary last year, Sanders lost Virginia to Hillary Clinton by nearly 30 points.

Perriello has embraced an economic populist message in his gubernatorial campaign. Northam and his allies challenge his progressive credentials, noting several conservative stances he took while in Congress. Early polling shows them tied.

The Virginia gubernatorial race is attracting intense national interest as one of just two governor’s races in the country this year and an early test of how voters are responding to President Trump.

Both Northam and Perriello have rejected comparisons of their primary to the contest between Sanders and Clinton, but this endorsement further fuels that perception.

Within minutes of the endorsement, Perriello’s campaign sent a fundraising email invoking Sanders.

“We have the momentum. We are drawing support from across the entire progressive movement,” Perriello wrote in the e-mail.

Jeff Weaver, Sanders’s former campaign manager who now leads Our Revolution, a group that grew out of the campaign, said the senator met with Perriello several weeks ago in Washington after Perriello reached out. The two men had met in passing before, a spokesman for Perriello said.

“In terms of moving forward with a progressive economic agenda that would benefit working families, they felt they had a lot in common,” said Weaver.

Sanders is campaigning with Perriello on Thursday at George Mason University in Fairfax County. Weaver said the 11-member board of Our Revolution will shortly decide whether to endorse in the race and lend its email list of millions for fundraising and volunteers.

Perriello also has been endorsed by former top political aides to Clinton and former president Barack Obama, including Clinton campaign chairman John Podesta and Obama campaign manager David Plouffe. His gubernatorial campaign is managed by Julia Barnes, the former national field director for Sanders’s presidential run.

Virginia Gov. Terry McAuliffe (D), a close ally of the Clintons who is constitutionally barred from seeking consecutive terms, is supporting Northam.

Responding to the Sanders’ endorsement, a Northam spokesman noted the lieutenant governor’s extensive support from local officials includes the only state lawmaker who backed Sanders in the primary, Del. Marcia Price (D-Newport News)

“Virginia Democrats who have worked with Ralph are supporting him because he has been a progressive leader in Virginia,” said spokesman David Turner.

Republican groups panned the endorsement by the self-described democratic socialist, saying it will push Perriello too far to the left to win in a general election.

Perriello and Northam are competing to run against the winner of the GOP primary race among former Republican National Committee chairman Ed Gillespie, state Sen. Frank Wagner (Virginia Beach) and Corey Stewart, the chairman of the Prince William Board of County Supervisors.