President Barack Obama on Wednesday morning sought to mollify an anxious nation that stands divided after one of the ugliest and most contentious presidential elections in modern American history, telling the country that everyone is on the same team and should root for the success of the country they live in.

Obama, who throughout the campaign made his contempt for Donald Trump known, said he was "heartened" by a conversation he had with the now president-elect early Wednesday morning after results come in.

"We are now all rooting for his success in uniting and leading the country," Obama said in a speech from the White House Rose Garden. "The peaceful transition of power is one of the hallmarks of our democracy, and over the next few months we are going to show that to the world."

Obama struck a similar tone to Hillary Clinton's concession speech, delivered just minutes earlier in New York.

Like Clinton, he said young people should not get cynical after this election.

"[Democracy] is hard and sometimes contentious and noisy; it's not always inspiring," Obama said. "But to the young people who got into politics for the first time and may be disappointed by the results, I just want you to know you have to stay encouraged. Don't get cynical. Don't ever think you can't make a difference."

He also praised Clinton, who he said "has lived an extraordinary life of public service."

"A lot of Americans look up to her," Obama said. "Her candidacy and nomination was historic and sends a message to our daughters all across our country that they can achieve at the highest level of politics."