Former President Barack Obama on Thursday returned to the campaign trail for the first time since leaving office, traveling to predominantly black cities to implore Democrats to vote in upcoming gubernatorial races as he railed against the “politics of division.”

During a campaign rally for New Jersey Democratic gubernatorial candidate Phil Murphy in Newark, Obama didn’t explicitly criticize his successor, President Donald Trump. But he suggested the politics of today are reminiscent of the “19th century.”

“What we can’t have is the same old politics of division that we have seen so many times before that dates back centuries,” Obama said. “Some of the politics we see now, we thought we put that to bed.”

Obama added, "it's the 21st century, not the 19th century."

He made the comments as he encouraged Democrats to vote for Murphy, who served as ambassador to Germany during the Obama administration and is running against New Jersey Republican Lt. Gov. Kim Guadagno.

“You can’t take this election for granted, or any election, for granted,” Obama said. “I don’t know if y’all noticed that. But you can’t take any election for granted.”

He encouraged attendees to get their friends and family to the polls too.

“You got to get cousin Pookie,” the former president said to laughter. “You got to get, you know, you got to get Uncle Jimmy, he’s been on the couch, he’s drinking a beer, he doesn’t even remember it’s an election.”

In New Jersey, incumbent Republican Gov. Chris Christie is term limited. A Fox News Poll released this week of likely voters in New Jersey show Murphy ahead of Guadagno 47 percent to 33 percent.

Obama then traveled to Virginia to deliver a speech Thursday night at a campaign rally for Democratic gubernatorial candidate Ralph Northam, who is running against Republican nominee Ed Gillespie.

"At a time when so many of us can be so cynical about government and public service, to have somebody step up who you can trust, and just wants to do right by the people of Virginia, that's worth something," Obama said of Northam.

The former president said Northam "devoted his time to the next generation," referencing his time teaching at a medical school and when he served in the Army at the Walter Reed medical center.

Obama also noted how he had regulary visited the medical center during his time in the White House, a comment seemingly in response to President Trump's comments that past presidents didn't always call the families of fallen troops.

"I can tell you as somebody who visited Walter Reed consistently throughout my 8 years... what it meant to have a medical staff who would literally help rebuild peoples' lives after they had served our country in such a profound way," he said.

In Virginia, Democrats are also ahead, with Northam, the state’s lieutenant governor, leading Gillespie, a former top aide to George W. Bush, 49 to 42 percent in the latest Fox News Poll. Incumbent Democratic Gov. Terry McAuliffe is also term limited.

Both the New Jersey and Virginia elections take place Nov. 7.