President Barack Obama will speak up against Donald Trump's presidency when America's "ideals" are at stake but will not insert himself into political battles, he said, in the clearest statement yet on how he will carry himself after leaving office.

Mr Obama was among Mr Trump's sharpest critics during the campaign, portraying the Republican candidate as childish, selfish and dangerous, and even after the election stood by his claim that the president-elect is unfit to serve as commander-in-chief.

He said on Sunday night that he would balance those concerns with respect for "the office", and the precedent set by the likes of George W Bush, who refrained from criticising their successors.

“If there are issues that have less to do with the specifics of some legislative proposal or battle, but go 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 during a news conference in Peru, amid his last foreign trip as president.