President Barack Obama speaks to the media during a news conference in the Brady press briefing room at the White Housein Washington, D.C., late last year. (Andrew Harnik/Associated Press)

Former president Barack Obama is making his first campaign foray of 2017, agreeing to stump for Democrat Ralph Northam in his bid to be Virginia’s next governor.

David Turner, a spokesman for Northam, said the former president agreed this week to hit the campaign trail for Northam, but would not say when or where.

An aide to Obama confirmed that the former president agreed to campaign for Northam during a congratulatory call, although no events have been planned.

The HuffPost first reported Obama’s plans to campaign for Northam.

The Virginia governor’s race, one of just two gubernatorial contests this year, is shaping up as the next high-profile electoral contest in the era of President Trump. It follows a couple of Democratic losses in high-profile special elections to fill congressional vacancies, including a race in Georgia last week that became the most expensive in U.S. history.

Virginia Democratic gubernatorial candidate Ralph Northam, the state's lieutenant governor. (Cliff Owen/Associated Press)

Obama, who carried Virginia in 2008 and 2012, could help Northam improve his support among younger voters and solidify his already strong backing from African American voters. Northam’s strongholds in the Democratic primary were in the “Urban Crescent,” the heavily populated areas of Northern Virginia, Richmond and Hampton Roads.

Northam faces Ed Gillespie, a longtime Republican operative and party leader, in November. Gillespie spokesman David Abrams dismissed the potential appeal of the former president.

“How many Democratic surrogates is it going to take to try to drag the lieutenant governor across the finish line?” he said. “Virginians deserve to hear from candidates directly, in their own voices, about their own ideas and proposals.”

Gillespie recently campaigned with Wisconsin Gov. Scott Walker (R).

Obama stayed out of the hard-fought Democratic primary this month between Northam and former congressman Tom Perriello. Northam, who beat Perriello, called former attorney general Eric H. Holder Jr. with an appeal to prevent Obama from endorsing in the race, according to a Democrat familiar with the call.

But Perriello, who lost his seat in Congress over his vote for the Affordable Care Act and then went on to work for the Obama administration, invoked the former president anyway, airing footage of him with Obama in campaign ads.

Since leaving office, Obama has stayed in the political fray, condemning President Trump’s travel ban and decision to withdraw from the Paris climate accords, as well as Republican attempts to gut his signature health-care law.

(Amber Ferguson,Jorge Ribas,Dalton Bennett/The Washington Post)

But he did not campaign for Democrats in congressional elections this year, though he did cut a video endorsing Emmanuel Macron in the French presidential election.

Obama has said redistricting will be his primary cause. He says he wants to help rebuild Democratic strength by preventing Republicans from drawing legislative maps that are favorable to them and will define the political landscape for the next decade. The National Democratic Redistricting Committee, chaired by Holder, has made Virginia’s gubernatorial and House of Delegate races its first campaign targets.

At a Democratic fundraiser in Richmond this month, Holder said Virginia was at the “epicenter of the political universe in 2017” and promised that his group would bring Democratic all-stars to the campaign trail.

Obama’s predecessor, George W. Bush, largely kept a low political profile after leaving the White House, waiting seven years before he campaigned for his brother Jeb Bush’s failed presidential bid.

Bush also has connections to the Virginia contest: He tapped Gillespie to serve as chairman of the Republican National Committee early in his presidential term, and later brought him into the White House as his counselor. The former president attended a March fundraiser for Gillespie in Dallas and wrote a $25,000 check for his gubernatorial campaign.