Updated

Declaring "yes we did," President Obama used his farewell address in Chicago Tuesday night to tout and defend his administration's record of change over the last eight years -- while voicing regrets about rising partisanship and frayed race relations as he prepares to transfer power next week to President-elect Donald Trump.

“It’s good to be home,” Obama said in his speech to the thousands gathered at Chicago's McCormick Place. “Tonight it’s my turn to say thanks.”

Obama used the speech to warn of an increasingly divided nation, saying "we’re not where we need to be, and all of us have more work to do" to solve racial and economic inequality in particular.

However, he told the crowd that after eight years as president, he still believes in “the beating heart of our American idea – our bold experiment in self government.”

"I am asking you to believe. Not in my ability to bring about change – but in yours."

Faced with the President-elect Donald Trump's vows to roll back many of his policies, the president spent much of his speech defending his legacy.

“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," he said, before listing off a series of other achievements, "...you might have said our sights were set a little too high."

When he mentioned his successor, the crowd booed but was quickly silenced by Obama. In a marked departure from his fiery stump speeches during the election campaign on behalf of Hillary Clinton, he chose not to attack Trump directly, but called for America to rediscover a sense of common purpose.

He gave a sign that he may follow this himself, by saying about plans to gut ObamaCare: “if anyone can put together a plan that is demonstrably better than the improvements we’ve made to our health care system – that covers as many people at less cost – I will publicly support it.”

Yet, while citing his achievements, Obama warned that particularly on racial and economic inequality, America's democracy still faces serious threats, warning race is still a divisive force in the country.

"After my election, there was talk of a post-racial america. In such a vision, however well intended, it was never realistic," he said.

In addition to foreign threats from ISIS to Russia and China, he warned about threats from home -- including warning about efforts to label some people “more American than others.”

“We’re not where we need to be. All of us have more work to do. After all, if every economic issue is framed as a struggle between a hardworking white middle class and undeserving minorities, then workers of all shades will be left fighting for scraps while the wealthy withdraw further into their private enclaves,” he said.

The speech, which was attended by First Lady Michelle Obama and daughter Malia, was frequently interrupted by cheers and applause from the audience. When he thanked his family for their support, Obama was visibly emotional, and paused to wipe away tears.

Obama also used the speech to warn against a growing partisanship, which he says threatens American democracy, and risks ruining political debate.

“Increasingly, we become so secure in our bubbles that we accept only information, whether true or not, that fits our opinions, instead of basing our opinions on the evidence that’s out there,” he said.

"But without some common baseline of facts; without a willingness to admit new information, and concede that your opponent is making a fair point, and that science and reason matter, we’ll keep talking past each other, making common ground and compromise impossible.”

He called on Americans to be vigilant about democracy and not to take it for granted. Obama issued a rallying cry to his supporters, saying: “If you’re tired of arguing with strangers on the internet, try to talk with one in real life.”

“If something needs fixing, then lace up your shoes and do some organizing. If you’re disappointed by your elected officials, grab a clipboard, get some signatures, and run for office yourself,” he said. “Show up. Dive in. Stay at it. Sometimes you’ll win. Sometimes you’ll lose.”

The Associated Press reported that Obama directed his team to craft an address that would feel "bigger than politics" and speak to all Americans — including those who voted for Trump.

His chief speechwriter, Cody Keenan, started writing it last month while Obama was vacationing in Hawaii.

The AP reports that former aides, including advisers David Axelrod and Robert Gibbs, were consulted on the speech.

The Associated Press contributed to this report.