President Obama walked off the stage Wednesday sounding remarkably like the political newcomer who burst onto the political scene 13 years ago.

That Obama, a neophyte state senator from Illinois, was striking mostly for his faith in America’s institutions, its founding documents and its people.

“Hope in the face of difficulty,” he preached in a speech to the 2004 Democratic National Convention in Boston. “Hope in the face of uncertainty. The audacity of hope . . . a belief that there are better days ahead.”

That was the message that Obama returned to again and again in his final news conference as president.

“I believe in this country,” he said. “I believe in the American people.”

President Obama walks away at the end of his final press conference at the White House on Jan. 18. (Nicholas Kamm/AFP/Getty Images)

Long before President-elect Donald Trump’s surprising victory shook Washington, Obama was worrying about the threats to American democracy. In a series of speeches, starting with his State of the Union address last January, he spoke about the dangers of inequality, growing racial divisions, and how a dramatic decline in civility was hurting the country and weakening its democratic institutions. Those were some of the themes that dominated his farewell speech last week in Chicago.

“If you’re tired of arguing with strangers on the Internet, try talking with one of them in real life,” Obama bluntly advised last week.

Obama’s final news conference included a few of those downbeat notes. He took questions on many of the normal hot-button issues that have defined the fourth quarter of his presidency: Russia, WikiLeaks, immigration, race, Cuba and his failed efforts to broker peace between Israelis and Palestinians.

He predicted that a move by Trump to deport “dreamers” — young undocumented immigrants who have spent most of their lives in the United States — would draw him back into the political scrum.

But Obama’s final news conference was most memorable for his hopeful vision, which has endured multiple wars, many mass shootings and the unmistakable sense that the country has grown more polarized and angry on his watch.

When the president was asked if he was worried about whether progress on LGBT rights would endure under Trump, Obama insisted that the biggest changes during his tenure were spurred by activists outside of government and, in many cases, far from Washington.

“The primary heroes . . . are all the individuals and activists and sons and daughters and couples who courageously said, ‘This is who I am, and I am proud of it,’” Obama said. “That opened people’s minds and opened their hearts and eventually the laws caught up.”

This was the kind of activism that Obama had long defined as uniquely American and cited as evidence of the country’s exceptional nature.

[How Obama has used his presidency to redefine American exceptionalism]

Later he was asked how he had explained the “meaning” of Trump’s victory to his daughters. The president took the opportunity to brag about this children.

“Man, my daughters are something,” he boasted.

Then he bragged about the country he has led.

In his very first news conference as president in 2009, Obama described himself as “the eternal optimist.”

“I think over time, people respond to civility and rational argument,” he said. “I think that’s what . . . people around America are looking for.”

In his final news conference, Obama chose to ignore the ample body of evidence that he may have been mistaken.

Instead, he returned to his core progressive belief that determined activism would inexorably produce a less divided and more just country.

“If we work hard and if we are true to those things in us that feel true and feel right, the world gets a little better each time,” he said.

That was Obama’s final message.

“That’s what this presidency has tried to be about,” he said.