Former president Barack Obama is returning to the campaign trail for the first time since he left the White House, planning to appear at a rally with Ralph Northam, Virginia’s Democratic gubernatorial candidate, on Oct. 19 in Richmond.

Northam's campaign announced the event Wednesday — four months after first revealing the former president would join him on the campaign trail.

Obama’s foray into the governor’s race could inject energy into what has been a relatively sleepy race. A Washington Post-Schar School poll found fewer people were closely watching the contest than at the same point in 2013, despite the fact that the major parties view the contest as a test of politics in the era of President Trump.

Virginia is holding the nation’s only competitive statewide contest in November; the Democrat is heavily favored in New Jersey’s gubernatorial race.

The Obama rally will be open to the public, but advanced tickets are required. The location has not yet been announced.

Former President Barack Obama, smiles as he delivers a speech during the Green Economy Summit 2017. (Pablo Gasparini/AFP/Getty Images)

Richmond, the capital of Virginia, is part of the heavily populated “Urban Crescent” that includes D.C. suburbs and the Hampton Roads region where strong turnout and margins are crucial for Democrats.

Obama is well-regarded by Virginia’s African Americans, who are a key slice of the electorate and helped Gov. Terry McAuliffe (D) win four years ago over Republican Ken Cuccinelli II. McAuliffe is prohibited by state law from seeking a second consecutive term.

Obama carried Virginia in the 2008 and 2012 elections, becoming the first Democrat to do so since Lyndon B. Johnson in 1964. He left office with nearly six in 10 Virginia voters approving of his performance.

His support is seen as so critical that Northam worked behind the scenes to ensure Obama would stay neutral in Northam's Democratic primary against former congressman Tom Perriello.

The Obama rally is scheduled days after the current and former vice president are set to hit the campaign trail in the governor’s race.

Vice President Pence is rallying with Republican nominee Ed Gillespie in southwest Virginia on Saturday evening. Earlier in the day, former vice president Joe Biden will appear with Northam at a roundtable workforce development session in northern Virginia that is closed to the general public.

President Trump last week tweeted an endorsement of Gillespie, which also falsely claimed that Northam fights for "violent MS-13 killer gangs." It's unclear if Trump will hit the campaign trail in Virginia, and Gillespie has tried to downplay the significance of his tweet. While Trump is popular with the Republican base in Virginia, he is highly unpopular with the general public. Virginia was the only Southern state carried by Hillary Clinton in her race against Trump last year.

The latest stories and details on the 2017 Virginia general election and race for governor.

Other party leaders have lent their star power to help the gubernatorial candidates raise money.

Former President George W. Bush is scheduled to headline two fundraisers for Gillespie on Oct. 16. Hillary Clinton headlined a Northam fundraiser in New York earlier in the month.