President Barack Obama has called on Americans to defend their democracy in his farewell speech in Chicago.
“By almost every measure, America is a better, stronger place” than it was eight years ago when he took office, he told thousands of supporters.
But he warned “democracy is threatened whenever we take it for granted”.
He implored Americans of all backgrounds to consider things from each other’s point of view, saying “we have to pay attention and listen”.
The country’s first black president, now 55, was first elected in 2008 on a message of hope and change.
His successor, Donald Trump, has vowed to undo some of Mr Obama’s signature policies. He will be sworn into office on 20 January.
Raucous chants of “four more years” from the crowd were brushed aside by the president. “I can’t do that,” he said with a smile. US presidents are limited to two terms by the constitution.
“No, no, no, no no,” he said, when the crowd booed the prospect of Mr Trump replacing him.
Striking an upbeat tone, Mr Obama said that the peaceful transfer of power between presidents was a “hallmark” of American democracy.
But, he outlined three threats to American democracy – economic inequality, racial divisions and the retreat of different segments of society into “bubbles”, where opinions are not based on “some common baseline of facts”.
“If you’re tired of arguing with strangers on the internet, try to talk with one in real life,” he said to laughter and applause.
In his closing remarks he said he had one final request for Americans as president: “I am asking you to believe. Not in my ability to bring about change – but in yours.”
Returning to Chicago, where he first declared victory in 2008, Mr Obama delivered a mostly positive message to Americans after a divisive election campaign which saw to Mr Trump defeat Democrat Hillary Clinton.
Mr Obama said that young Americans – including those who worked on his campaigns, and who believe “in a fair, just, inclusive America” – left him feeling “even more optimistic about this country than I was when we started”.
In choosing Chicago, Mr Obama had earlier said he wanted to return to “where it all started” for him and First Lady Michelle Obama, instead of delivering the speech from the White House.
Barack Obama’s final speech – in quotes
After my election, there was talk of a post-racial America. Such a vision, however well-intended, was never realistic. For race remains a potent and often divisive force in our society. I’ve lived long enough to know that race relations are better than they were 10, or 20, or 30 years ago.
On his achievements
If I had told you eight years ago that America would reverse a great recession, reboot our auto industry, and unleash the longest stretch of job creation in our history… If I had told you that we would open up a new chapter with the Cuban people, shut down Iran’s nuclear weapons programme without firing a shot, and take out the mastermind of 9/11… If I had told you that we would win marriage equality, and secure the right to health insurance for another 20 million of our fellow citizens – you might have said our sights were set a little too high.
On Michelle Obama
Michelle LaVaughn Robinson, girl of the South Side, for the past 25 years, you’ve been not only my wife and mother of my children, you have been my best friend. You took on a role you didn’t ask for and you made it your own with grace and grit and style and good humour. You made the White House a place that belongs to everybody.