This was the way Barack Obama had imagined these years would be.

He started thinking about it long before the shock of President Trump's election, before the rout of his party that would be the coda to his two terms in office, even before he stood on the frigid grounds of the Old State House in Springfield in February 2007, and declared he was running for president.

A decade later found him here at the opening of a two-day summit to launch his foundation and yet-to-be-built presidential library.

"When I asked myself after the presidency, 'How could I have an impact?,' " Obama said, "the thing that was most exciting for me was the idea of creating a hub, a venue, a place, a network in which all of these young people across the globe and across the country, that all of these young people from every race, and every background and every religion could start meeting each other, and seeing each other and teaching each other and learning from each other."

For the former president himself, it was a literal and spiritual homecoming, at a downtown hotel just a few miles from the housing projects where he found his early calling as a community organizer in the 1980s, and the lakefront park where he and nearly a quarter-million supporters celebrated his election as the nation's first African American president in 2008.

"Even after I left community organizing, the lessons that I had learned about people and about being rooted in communities and listening and sharing stories and creating power from the bottom up rather than the top down to bring about real change — those lessons never left me," Obama said. "I carried those lessons with me even after I became president of the United States."

The event had the earnestness of a TED Talk, the nostalgia of a family reunion, and a dollop of the celebrity allure that envelops all things Obama.

Obama convened famous friends such as Britain's Prince Harry and "Hamilton" writer and star Lin-Manuel Miranda, along with more than 500 budding activists from 60 countries and 27 states. The schedule included speakers and wonky panel discussions on topics from community engagement to empowering women and girls, to social media responsibility.

The former first couple listen to a speaker at the first session of their foundation’s summit, which had the earnestness of a TED Talk, the nostalgia of a family reunion, and a dollop of the celebrity allure that envelops all things Obama. (Charles Rex Arbogast/AP)

"He's bringing together strands of his past and things he was particularly excited about during his presidency," said Susan E. Rice, who was Obama's United Nations ambassador and national security adviser.

The former president never mentioned Trump, and made only an oblique reference to the current divisiveness.

"The moment we are in right now is the tail not the dog," Obama said. "What we need to do is think about our civic culture, because what's wrong with our politics is a reflection of the problems in our civic culture."

Even before he announced his bid for the Oval Office, Obama was considering how he would spend these years.

He would be the fifth-youngest man to be inaugurated the nation's chief executive, which carried the presumption that he would be given far more years than most to shape his legacy and manage a last act.

That, in fact, was part of why Obama made what many believed to be a premature, even impudent leap by a 45-year-old, first-term U.S. senator over others who had been climbing the ladder far longer.

"It appealed to him that he would be a relatively young man when he finished his presidency, and he would have a useful life ahead," said David Axelrod, his chief political strategist.

He imagined that his post-presidency would not be a twilight but a luxuriant afternoon heavy with possibility.

Circumstances, however, have brought another, more urgent set of forces with which Obama must grapple.

His party is shut out of power and lacking in leadership; his successor is intent on tearing down his greatest achievements — health-care overhaul, an international climate accord, the Iran arms deal, new procedures to spare from deportation children brought to this country illegally by their parents, and so much more.

"To be honest, I inherited a mess," Trump said shortly after taking office. "We'll take care of it, folks."

There are those who say that the 44th president is the best possible figure to lead the resistance to the 45th.

Obama is not among them.

FMichelle and Barack Obama make their entrance at the Obama Foundation Summit in Chicago on Tuesday. (Jim Young/AFP/Getty Images)

Ex-presidents are also bestowed a status as international elder statesmen. Obama has traveled to Germany, Indonesia and Brazil and hosted foundation events to train civic leaders in those countries.

Obama has been more cautious when it comes to partisan politics. He has said he will weigh in occasionally on specific issues; a few weeks ago, he returned to the campaign trail for Democratic gubernatorial nominees in Virginia and New Jersey.

He has noted: "I believe in the wisdom that George Washington showed, that at a certain point, you make room for new voices and fresh legs."

William Galston, a senior fellow at the Brookings Institution, said Obama is "within the historical zone, the normative area for former presidents, especially compared to President Trump, who prides himself on never leaving an attack unanswered. I don't see Barack Obama as having reentered the ring to try to throw blows at a president who is trying to undo his agenda and legacy."

That is in part because when Obama was in office, he had appreciated the restraint his predecessors showed in commenting on his performance.

"The two presidents Bush had taught him a lesson in how to be a former president," Axelrod said.

But Obama is also seeking to create something uniquely his own.

"This idea of being a community organizer goes way back for Obama so what he is doing is really who he is," said Burton Kaufman, historian and author of "The Post-Presidency From Washington to Clinton."

Kaufman contrasted Obama's perspective from that of former president Jimmy Carter, who has tackled international conflicts, and Bill Clinton, who has leveraged large contributions to undertake specific projects.

"If we could create an architecture, a platform for those young people to thrive and to scale up all of those things they were doing globally," Obama said, "then there's no problem we couldn't solve."

Aalap Shah, Mariana Alfaro and Hannah Wiley contributed to this report.