On Monday, just hours before he flew across the Atlantic, Mr. Obama offered conciliatory remarks on Mr. Trump and his coming administration during a White House news conference. He declined on Monday to comment on Mr. Trump’s selection of Mr. Bannon — a media executive whose website, Breitbart.com, has promoted white nationalist, racist and anti-Semitic views — as chief White House strategist and senior counselor.

By Tuesday, however, Mr. Obama seemed to reverse himself, making pointed remarks about the dangers of overturning his administration’s track record on race relations or returning to decades-old forms of bigotry.

“In the United States, we know what happens when we start dividing ourselves along lines of race or religion or ethnicity. It’s dangerous,” he said. “Not just for the minority groups that are subjected to that kind of discrimination or, in some cases in the past violence, but because we don’t then realize our potential as a country when we’re preventing blacks or Latinos or Asians or gays or women from fully participating in the project of building American life.”

Mr. Obama was unapologetic and unequivocal on his record of inclusiveness.

“So my vision’s right on that issue,” he said. “And it may not always win the day in the short term in any particular political circumstance, but I’m confident it will win the day over the long term.”

Mr. Obama said that the desire for change was a huge factor in Mr. Trump’s victory.

“Sometimes people just feel as if we want to try something to see if we can shake things up, and that I suspect was a significant phenomenon,” he said.