US President Barack Obama bid farewell to the world stage Sunday, pondering his legacy, offering advice to his successor and discussing his post-presidential life at the end of his final foreign tour.

His historic presidency and charisma have made Obama a rock star on the international scene, even at times when the daily grind of politics dimmed the glow around his election as the United States' first black president in 2008.

Obama spoke to both the American people and the world as he gave his final foreign press conference in Lima, Peru.

But ultimately, those two audiences are inseparably linked, he insisted.

It was a key message as he prepares to hand over to President-elect Donald Trump -- who has spooked some in the international community with his volatile style and isolationist rhetoric.

Several of Obama's fellow world leaders said an emotional goodbye as they wrapped up a summit.

"It's a great moment, but a sad moment, to have our last meeting," said Australian Prime Minister Malcolm Turnbull.

"I am going to miss having Barack around," said Canada's Justin Trudeau, in comments that were tinged with a sense of uncertainty about things to come.

Here are some key points from Obama's remarks:

Globalization

Obama's last presidential trip was dominated by the deep uncertainty Trump has unleashed about the postwar world order with his attacks on free trade and the US role as "policeman of the world."

Obama said an increasingly borderless world has brought "historic gains in prosperity, education and health," but acknowledged globalization had both winners and losers.

"When jobs and capital can move across borders, when workers have less leverage, when wealthy corporations seem to be playing by a different set of rules, then workers and communities can be hit especially hard," he said.

"That can reverberate through our politics. That's why I firmly believe one of our greatest challenges in the years ahead across our nations and within them will be to make sure that the benefits of the global economy are shared."

President Trump

It was an awkward trip for Obama, who campaigned against Trump as an unfit successor but now wants to reassure US allies on the future.

He asked the world to treat the brash billionaire as he himself vowed to do: "Wait and see."

At the same time, he sought to pre-empt his successor on some key issues.

He announced his signature trade agreement in the Asia-Pacific, the TPP, was still alive despite Trump's vows to kill it, and said he wanted to reach a deal on the Ukraine crisis before leaving office.

He said Trump's presidency would likely be far different from his candidacy.

"Once you're in the Oval Office, once you begin interacting with world leaders, once you see the complexities of the issues, that has a way of shaping your thinking," Obama said.

Syria

The brutal war in Syria has been the most difficult foreign policy challenge of Obama's eight years in the White House.

He defended is decision not to invade the country, but warned no end to the bloodshed was in sight.

"I am not optimistic about the short term prospects in Syria," he said, blaming Russian and Iranian support for the Bashar al-Assad regime.

"Assad has been emboldened. This is man who has decided that destroying his country, turning it to rubble and seeing its population scattered or killed was worth it for him to cling to power," he said.

"At this stage, we're going to need to have a change in how all parties think about this."

Legacy

Obama voiced regret that, despite high approval ratings, he was stymied on issues like gun control, a minimum wage increase and infrastructure spending.

But he defended the values of his presidency.

"The touchstone is what's good for the American people," he said.

"At the end of the day and at the end of eight years, I can look back and say that I consistently did what I thought was best. Doesn't mean you don't make mistakes. But it means you're being true to your oath and the commitments you made to the people who elected you."

Life after presidency

Obama was clear about his first priority for post-presidential life: "Take (First Lady) Michelle on vacation."

The president said he wants to "get some rest, spend time with my girls and do some writing, do some thinking."

He does not plan to immediately wade back into politics.

"I want to be respectful of the office and give the president-elect an opportunity to put forward his platform," he said.

But Obama didn't rule it out altogether.

"As an American citizen who cares deeply about our country, if there's specifics that have less to do with some proposal or battle but goes to core questions about our values and our ideals, and if I think that it's necessary or helpful for me to defend those ideals then I'll examine it when it comes," he said.