Speaking at the White House, Nov. 9, President Obama vowed to work towards a peaceful transition of power to President-elect Donald Trump and encouraged young people not to become cynical. Here are key moments from that speech, in three minutes. (White House)

President Obama urged the country to unify Wednesday and pledged to work with President-elect Donald Trump, whom for months he lambasted as unfit to lead the country and who will now be succeeding him in office.

“It is no secret that the ­president-elect and I have had some pretty significant differences,” Obama said about Trump in a Rose Garden address. “One thing you realize in this job is that the presidency and the vice presidency is bigger than any of us.”

Obama likened the presidency to a relay race, telling the hundreds of exhausted and emotionally shaken White House staffers who packed the Rose Garden that they were leaving the country in a better position than it was eight years ago.

But for Obama, the election of Trump and the Republicans’ control of Congress puts at risk many of his signature policies over the past eight years. At the core of Trump’s campaign was a promise to repeal the Affordable Care Act and to scrap Obama’s executive actions on immigration and climate change. Trump also has promised to undo the president’s deal to prevent Iran from acquiring a nuclear weapon, the biggest foreign policy achievement of Obama’s second term.

These former Obama strongholds sealed the election for Trump

The president said he spoke with Trump about 3:30 a.m. Wednesday and invited him to come to the White House on Thursday to begin planning the transition to the next administration. Obama praised Hillary Clinton, the Democratic presidential nominee, for a hard-fought campaign and her decades of public service.

“I could not be prouder of her,” Obama said.

The president’s calls for the nation to come together carried a clear hint of his disgust with the way Trump ran his campaign. After the long, bitter election, Obama called for a “sense of unity, a sense of inclusion, and a respect for institutions, our way of life, rule of law and a respect for each other.”

“I hope he maintains that spirit through this transition,” Obama said of Trump, “and I hope that is how his presidency will begin.”

Many of the changes to Obama’s signature programs could happen quickly. Trump has vowed to pull out of the Paris Agreement to curb greenhouse gases and has promised to cancel an Environmental Protection Agency power-plant rule that is intended to cut emissions by 32 percent over the next nine years, compared with 2005 levels.

On immigration, Trump vowed to overturn Obama’s executive actions to grant work permits to millions of undocumented immigrants, including more than 700,000 younger immigrants already benefiting from the program. A Trump administration could also drop the government’s defense of legal challenges to his executive actions on immigration.

The inside story of How Donald Trump won the 2016 election

Obama’s push to persuade Congress to ratify the 12-nation ­Trans-Pacific Partnership, a massive trade deal that Trump savaged on the campaign trail, now looks dead. Trump has vowed to renegotiate other existing deals that are already in place.

Throughout his presidency, Obama was forced to pass legislation on party-line votes or to rely on executive actions after efforts to compromise with congressional Republicans failed. This approach has now left much of his agenda vulnerable, and in many cases, it exacerbates the country’s political divide.

Obama’s top aides have spoken repeatedly of the need for a third term of Democratic control to cement the president’s policies. On issues such as same-sex marriage, climate change and trade, they argued, he helped bring the country to a more progressive place and rejected the notion that Trump’s election was a repudiation of those policies.

“An election is a comparison between two people and two candidates on the ballot. It’s not an evaluation of who we are as a society,” Jen Psaki, the White House communications director, in an interview earlier this week.

Other administration officials insisted that the main force driving voter dissatisfaction was not economic dislocation but political gridlock and a broader revulsion with obstruction.

“Washington doesn’t work. But you know he’s tried,” said a senior administration official, who spoke on the condition of anonymity to discuss the results before the election results came in.

Some of the political advisers who have served the president and Clinton over the past decade expressed frustration with the election’s outcome. David Plouffe, who had served as Obama’s 2008 campaign manager and helped guide Clinton’s campaign, had predicted in late September that the Democratic nominee had a “100 percent chance of winning” the election.

“I’m sorry everyone,” he tweeted about 1 a.m. Wednesday. “Had to talk to my kids. Wrong, and remarkably so. But the idea of our country has always been stronger than an election.”

Obama in his remarks did his best to characterize the election returns as a normal event, even as it put his key initiatives over the past eight years in danger.

“The path that this country’s taken has never been a straight line,” he said. “We zig and zag, and that’s okay. . . . This incredible journey that we’ve been on, as Americans, will go on.”