Barack Obama called on voters to reject a growing "politics of division" and implied Donald Trump had set American democracy "back 50 years" as he returned to the campaign trail for the first time since leaving the White House.
In his first political speeches for nearly a year, the former president took thinly veiled swipes at his Republican successor as he condemned "folks who are deliberately trying to make folks angry" for a "short-term tactical advantage".
He told rallies in New Jersey and Virginia that voters could send a powerful message about the type of politics they want by backing Democrats in 7 November elections in the two states.
Addressing a cheering crowd in Newark, New Jersey, Mr Obama said: "What we can't have is the same old politics of division that we have seen so many times before, that dates back centuries."
Without mentioning Mr Trump by name, he added: "Some of the politics we see now, we thought we put that to bed. That's folks looking back 50 years. It's the 21st century, not the 19th century."
At a later stop in Richmond, Virginia, the Democrat said modern politics increasingly did not reflect basic American values of inclusivity and was driving people away from the process and corroding democracy.
"We've got folks who are deliberately trying to make folks angry, to demonise people who have different ideas, to get the base all riled up because it provides a short-term tactical advantage. Sometimes that feels frustrating," he said.
Many of Mr Obama's comments appeared to be aimed at Mr Trump, whose aggressive style and inflammatory rhetoric have led to frequent controversy and stoked political and racial tensions.
Mr Obama made the remarks on Thursday just hours after former president George W Bush, a Republican, also took an indirect swing at Mr Trump with a speech decrying "bullying and prejudice" while defending immigrants and trade.
Mr Obama's appearances were aimed at driving up Democratic turnout in New Jersey and Virginia, the only two states holding elections for governor this year. Democrats hope their former president can draw some of the young, minority and infrequent voters who powered his two elections to the White House out to the polls in off-year elections.
The two contests will be closely watched to see if Democrats can convert the grassroots resistance to Mr Trump into electoral wins after falling short earlier this year in four competitive special congressional elections.
The governor races, and a special election in December for a US Senate seat in Alabama, could offer clues to the national political mood ahead of next year's congressional elections, when all 435 seats in the House of Representatives and 33 of the Senate's 100 seats will be up for grabs. Republicans currently control both chambers.
Since leaving the White House in January, Mr Obama has frequently been forced to defend his record as Mr Trump and Republicans have tried to gut his signature healthcare law and roll back his immigration and environmental policies.
While he has rarely spoken out about politics in the past nine months, Mr Obama said it was critical that supporters get their friends and families to vote.
In Newark, he said no one should assume victory just because opinion polls show Phil Murphy, a former investment banker and US ambassador to Germany, has a comfortable lead on Republican opponent Kim Guadagno, the state's lieutenant governor.
"I don't know if you all noticed that, but you can't take any election for granted," he said in a reference to Democrat Hillary Clinton's surprise loss last year in the presidential race.
In the political battleground of Virginia, polls show a close contest between Democrat Ralph Northam, the state's lieutenant governor, and Republican Ed Gillespie, a former Republican National Committee chairman who has been endorsed by Mr Trump.
Mr Obama carried Virginia in both 2008 and 2012, and Democrat Hillary Clinton won the state over Mr Trump by five percentage points in 2016.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies