Outgoing president gives proud account of his eight years in office – and pays moving tribute to Michelle, ‘wife, mother of my children and best friend’

“Yes we can,” he said one last time. “Yes we did.” And the crowd roared.

Barack Obama – the son of a Kenyan goat herder and self-described “skinny kid with a funny name” who grew up to become America’s first black president – had come to say goodbye.

But while for most of the past eight years it had seemed this night would be one of joy and nostalgia, now it came with a sober note, laden with omens and warnings about a democracy under siege.

Obama had hoped to be talking about passing on the baton to fellow Democrat Hillary Clinton. Instead Donald Trump’s stunning victory implied an existential threat and called for him to paint on a bigger canvas. In a “state of our democracy” speech he deftly concentrated his fire not on the president-elect but on the malaise that produced him. In 4,300 words he only mentioned Trump by name once – but delivered much by way of repudiation.

Obama dismissed talk of post-racial America, in vogue after his own ascent in 2008, as unrealistic. He defended the rights of immigrants and Muslim Americans. He lambasted those who refuse to accept the science of climate change. He warned of the threat posed by “the rise of naked partisanship”, with people retreating into their own self-confirming bubbles.

There was not, perhaps, the piercing emotion of Obama’s greatest speeches. But when he came to thank his wife, Michelle, for standing by him through it all, an eulogy that prompted one of the biggest cheers of the night, he wept.

From healthcare to the Iran deal: which of Obama's policies will survive? Read more

They were back in their home city, Chicago, albeit in the unromantic surroundings of a dark and cavernous convention hall with giant US flag, presidential seal and TV screens. The make-up of the audience – male and female, young and old, diverse in race and religion – was itself a statement about who he was and what he stood for. They cheered and roared and whistled, rising in a wall of human noise, holding his memory tight.

“Every day I learned from you,” Obama told the audience. “You made me a better president and you made me a better man.”

Facebook Twitter Pinterest Michelle and Malia Obama react to the outgoing president’s tribute. Photograph: Pablo Martinez Monsivais/AP

It had been 2,989 days since the Obamas were greeted by nearly a quarter of a million supporters gathered in Chicago’s Grant Park on election night in 2008. “Maybe you still can’t believe we pulled this whole thing off,” he said wistfully.

And before he hit his stride there was an eruption from the audience. “Four more years! Four more years! Four more years!” they chanted. The president raised his hand and replied: “I can’t do that!” This is not a monarchy, after all.

“In 10 days the world will witness a hallmark of our democracy,” Obama said. That elicited some boos, but he pressed on: “The peaceful transfer of power from one freely elected president to the next.” Now there was applause. “I committed to president-elect Trump that my administration would ensure the smoothest possible transition, just as President Bush did for me.”

Over the past eight years Obama has travelled the globe extolling the American experiment in democracy, admitting its flaws but insisting that it strives for a more perfect union. He little expected to be ending his second term having to defend the great project on his home turf.

Democracy depended on equality, he argued, and the economy was growing again. But this was not enough. “Stark inequality is also corrosive to our democratic principles … a recipe for more cynicism and polarisation in our politics.”

Then he named a second threat to democracy. “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.”

Upholding laws against discrimination alone would not be enough, he said, adding that “hearts must change”. In a nod to the discontent in rust belt states that helped propel Trump to victory, he continued: “For blacks and other minorities it means tying our own struggles for justice to the challenges that a lot of people in this country face – the refugee, the immigrant, the rural poor, the transgender American, and also the middle-aged white man who from the outside may seem like he’s got all the advantages, but who’s seen his world upended by economic, cultural and technological change.”

But he added: “For white Americans it means acknowledging that the effects of slavery and Jim Crow didn’t suddenly vanish in the 60s; that when minority groups voice discontent they’re not just engaging in reverse racism or practising political correctness; that when they wage peaceful protest they’re not demanding special treatment, but the equal treatment our founders promised.”

Obama went on to tackle a hot topic in the wake of last year’s bitterly divisive presidential election: deep polarisation, even around what facts people consume. “For too many of us it’s become safer to retreat into our own bubbles, whether in our neighborhoods or college campuses or places of worship or our social media feeds, surrounded by people who look like us and share the same political outlook and never challenge our assumptions.

“The rise of naked partisanship, increasing economic and regional stratification, the splintering of our media into a channel for every taste – all this makes this great sorting seem natural, even inevitable. And 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.”

Citing climate change as an example, he added: “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.”

Democracy was threatened when taken for granted, Obama said, noting the relatively low turnout in US elections. “Our constitution is a remarkable, beautiful gift. But it’s really just a piece of parchment. It has no power on its own.”

Democracy needs you, he told an estimated audience of 18,000. “Not just when there’s an election, not just when your own narrow interest is at stake, but over the full span of a lifetime. If you’re tired of arguing with strangers on the internet, try to talk with one in real life.

“If something needs fixing, lace up your shoes and do some organising. If you’re disappointed by your elected officials, grab a clipboard, get some signatures, and run for office yourself. Show up. Dive in. Persevere. Sometimes you’ll win. Sometimes you’ll lose … More often than not your faith in America – and in Americans – will be confirmed.”

George Washington’s farewell address warned of the divisiveness of political parties. Dwight Eisenhower’s warned of the rise of the military industrial complex. So Obama cannot assume his words will be heeded.

His professorial side had been at the fore all night. But when he came to thank his family there was a shift. “Michelle LaVaughn Robinson, girl of the south side [of Chicago], 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. And a new generation sets its sights higher because it has you as a role model. You’ve made me proud. You’ve made the country proud.”

Michelle sat in the front row. The crowd erupted around her and gave an extended ovation. Beside her the couple’s daughter Malia welled up with tears.

Obama also paid tribute to Malia and sister Sasha – the latter absent due to a school exam in Washington the next day – saying: “Of all that I’ve done in my life I’m most proud to be your dad.”

Michelle and Malia, along with the vice-president, Joe Biden, and his wife, Jill, joined the president on stage to more cheers and goodbye waves from the crowd.

Sheila Baldwin, a 64-year-old African American, who got her ticket on Saturday after queuing from 5am, said: “My ancestors would appreciate and insist I see this historic event. It was thrilling for us to see my mother, who is 91, witness the first black president; now to see it come full circle is a wonderful moment.”

Obama shook hands with supporters, including civil rights struggle veteran Jesse Jackson, and stepped out of the limelight. To the end he appeared composed and serene: a man at peace with himself.