US President Barack Obama with his daughters Sasha, left, and Malia last year during the annual turkey-pardoning ceremony in the Rose Garden at the White House. Chip Somodevilla / Getty Images

Like millions of Americans, President Barack Obama was struggling to explain the results of last week's election, according to a New Yorker profile on the president.

Obama campaigned furiously for Democrat Hillary Clinton during the presidential race, and he repeatedly painted Republican Donald Trump as bigoted and xenophobic. Much of his legacy depended on a Clinton victory.

But when Trump won the election in a shocking upset, Obama still had some comforting words to say to his daughters.

"What I say to them is that people are complicated," Obama told The New Yorker's David Remnick:

"'Societies and cultures are really complicated … This is not mathematics; this is biology and chemistry. These are living organisms, and it's messy. And your job as a citizen and as a decent human being is to constantly affirm and lift up and fight for treating people with kindness and respect and understanding.

"'And you should anticipate that at any given moment there's going to be flare-ups of bigotry that you may have to confront, or may be inside you and you have to vanquish. And it doesn't stop … You don't get into a fetal position about it. You don't start worrying about apocalypse. You say, O.K., where are the places where I can push to keep it moving forward.'"

Trump and Obama seem to have struck a conciliatory tone since Trump's election, at least publicly. The two met privately last week, and Obama said he would continue to counsel Trump throughout the transition of power.

Read the full New Yorker profile here.

NOW WATCH: Popular Videos from Insider Inc.