Not long ago, President Obama had expected to use his farewell address to the nation to celebrate his administration’s achievements before handing them off to a Democratic successor.

Instead, in the wake of Donald Trump’s stunning upset victory, a president whose political rise was propelled by his ability to inspire hope arrived in Chicago on Tuesday night facing a new reality. Tempering the disappointment of his supporters and soothing their anxiety has become, in his waning days in office, Obama’s last, unexpected campaign.

“For every two steps forward,” Obama told the crowd at the McCormick Place arena, “it often feels we take one step back.”

Obama took the stage amid an air of nostalgia, joined by his wife and daughter, the vice president, a gaggle of former aides and 18,000 supporters who braved frigid temperatures this week to score a ticket. Familiar campaign anthems from U2 and Bruce Springsteen played at the arena where Obama had celebrated his 2012 reelection victory.

Most of his predecessors had delivered their final addresses to the nation from the more formal environs of the White House, but Obama eschewed that tradition, flying home on his final trip on Air Force One before leaving office next week. The choice was made to symbolize a return to the roots of his political career, and Obama has always felt more comfortable and energized at campaign-style rallies before big, adoring crowds.

The president delivered his farewell speech to the nation in his home town of Chicago.

“Hello, Chicago, it’s good to be home!” he began, before being cut off by cheers from the crowd. Basking in extended applause, Obama feigned impatience: “We’re on live TV here . . .”

But the warm embrace from his adopted hometown may have served another purpose, too, in helping to insulate Obama and his faithful from the stark reality that his goodbye speech was not the crowning valedictory they had so recently anticipated.

Over the course of 4,500 words, the president delivered a determined pep talk and reality check, warning his audience not to lose faith in democracy or to give up participating in the American experiment.

“Show up. Dive in. Stay at it,” he urged. “Sometimes you’ll win. Sometimes you’ll lose . . . And more often than not, your faith in America — and in Americans…