(The story refiles, to fix quote in 14th paragraph to read “middle-aged white guy,” not “middle-aged white man”; read “has seen his world,” not “who’s seen his world”; add dropped word “and”)

CHICAGO (Reuters) - With a final call of his campaign mantra “Yes We Can,” President Barack Obama urged Americans on Tuesday to stand up for U.S. values and reject discrimination as the United States transitions to the presidency of Republican Donald Trump.

In an emotional speech in which he thanked his family and declared his time as president the honor of his life, Obama gently prodded the public to embrace his vision of progress while repudiating some of the policies that Trump promoted during his campaign for the White House.

“So just as we, as citizens, must remain vigilant against external aggression, we must guard against a weakening of the values that make us who we are,” Obama told a crowd of 18,000 in his hometown of Chicago, where he celebrated his election in 2008 as the first black president of the United States.

Trump, who takes office on Jan. 20, proposed temporarily banning Muslims from entering the country, building a wall on the border with Mexico, upending a global deal to fight climate change and dismantling Obama’s healthcare reform law.

Obama made clear his opposition to those positions during fiery campaign speeches for 2016 Democratic presidential nominee Hillary Clinton, but has struck a more conciliatory tone with Trump since the election.

In his farewell speech, he made clear his positions had not changed and he said his efforts to end the use of torture and close the U.S. prison in Guantanamo Bay, Cuba, were part of a broader move to uphold U.S. values.

“That’s why I reject discrimination against Muslim Americans,” he said in a clear reference to Trump that drew applause.

He said bold action was needed to fight global warming and said “science and reason” mattered.

Slideshow ( 16 images )

“If anyone can put together a plan that is demonstrably better than the improvements we’ve made to our healthcare system that covers as many people at less cost, I will publicly support it,” he said in another prodding challenge to his successor.

Trump has urged the Republican-controlled Congress to repeal the law right away.

RACE AND NOSTALGIA

Obama, who came to office amid high expectations that his election would heal historic racial divides, acknowledged that was an impossible goal.

“After my election, there was talk of a post-racial America,” he said. “Such a vision, however well-intended, was never realistic. Race remains a potent and often divisive force in our society.”

However, Obama said he remained hopeful about the work that a younger generation would do. “Yes we can,” he said. “Yes we did.”

In an indirect reference to the political work the Democratic Party will have to do to recover after Clinton’s loss, Obama urged racial minorities to seek justice not only for themselves but also for “the middle-aged white guy who from the outside may seem like he’s got advantages, but has seen his world upended by economic and cultural and technological change.”

Trump won his election in part by appealing to working-class white men.

Slideshow ( 16 images )

First Lady Michelle Obama, Vice President Joe Biden, his wife Jill Biden, and many current and former White House staff members and campaign workers attended the speech. Obama wiped his eyes as he addressed his wife and thanked his running mate. They all appeared together on stage after the address.

The Chicago visit is Obama’s last scheduled trip as president, and even the final flight on the presidential aircraft was tinged with wistfulness.

It was the president’s 445th “mission” on Air Force One, a perk he has said he will miss when he leaves office, White House spokesman Josh Earnest said.

All told, Obama will have spent more than 2,800 hours or 116 days on the plane during his presidency.

Obama plans to remain in Washington for the next two years while his younger daughter, Sasha, finishes high school. Sasha, who has an exam on Wednesday, did not attend the speech but her older sister Malia was there.

The president has indicated he wants to give Trump the same space that his predecessor, Republican President George W. Bush, gave Obama after leaving office by not maintaining a high public profile.