President Barack Obama said he intends to give his successor the room to establish his priorities, but didn't promise to stay on the sidelines if Donald Trump's administration takes actions Obama believes run counter to democratic values.

"President [George W.] Bush could not have been more gracious to me when I came in," Obama said at a press conference Sunday in Lima, Peru – the final leg of the last foreign trip of his presidency.

"My intention is to, certainly for the next two months, is finish my job," he said. "And then … I want to be respectful of the office and give the president-elect an opportunity to put forward his platform and his arguments without somebody popping off in every instance."

But Obama implied he would not stay silent if he feels he needs to defend "our values and our ideals" in the face of a Trump proposal.

Though he did not discuss specifics on Sunday, the president in the past has said Trump's call for a temporary ban on Muslims entering the U.S. "betrays the very values America stands for."

"As an American citizen who cares deeply about our country, 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," Obama said.

If he were to speak out, Obama would be upending a tradition of former presidents declining to comment on their successors' performance.

But following an election that saw Democrats fail to take back the Senate and lose the White House – likely guaranteeing conservative control of the Supreme Court for years to come as well – Obama and the Democrats are faced with trying to plot a path back to power.

For those still in office in Washington, that has meant struggling with how best to resist Trump and congressional Republicans, who could move to steamroll the Democratic minority by changing Senate rules and doing away with the filibuster .

"My advice to Democrats is, know what you care about and what you stand for and fight for your principles, even if it's a hard fight," Obama said. "If there are areas where the new administration is doing something that's good for the American people, find a way to work with them."

But the challenge is one that will haunt Democrats for years, as the two major parties have become increasingly split along an urban-rural divide that favors the rural – and thus, the GOP – in the Electoral College and both chambers of Congress.

Obama also will leave office as Democrats see their authority at the state level across the nation fall to its lowest point in 150 years , a trend that, unless reversed, will give Republicans a substantial edge heading into the next congressional redistricting after the 2020 elections.

Redistricting reform is an area Obama has already identified as one of his post-presidency tasks, teaming up with his former Attorney General Eric Holder to work with a new group focused on the issue.

"There are just some structural problems that we have to deal with," he said Sunday. "Doing better, as I said, involves us working at the grass-roots; not ceding territory; going out into areas where right now we may not stand a chance of actually winning but we're building up a cadre of young talent; we're making arguments; we're persuading; we're talking about the things that matter to ordinary people, day to day, and trying to avoid some of the constant distractions that fill up people's Twitter accounts.