President Barack Obama voiced support for House Minority Leader Nancy Pelosi (D.-Calif.) at his Sunday press conference in Lima, Peru after the close of the Asian-Pacific Economic Cooperation’s 2016 meeting, while House Democrats prepare to choose between Pelosi and Rep. Timothy Ryan (D.-Ohio).

“I think Nancy Pelosi is an outstanding and historic political leader,” said the president, who was wrapping up the last trip abroad of his tenure at APEC.

The president did not mention Ryan, for whom he has campaigned in the last electoral cycle, but he did acknowledge there is a leadership contest.

“I don’t normally meddle with party votes, and certainly on my way out the door, probably I shouldn’t meddle here,” he said. “I cannot speak highly enough of Nancy Pelosi. She combines strong, progressive values with just extraordinary political skill.”

Pelosi became the first female Speaker of the House in January, 2007, after the Democrats won control of the House in the 2006 midterms. That success in 2006 was a Democratic wave that swamped Republicans out of power, not only in the House, but it also gave Democrats the majority of the nation’s governors and brought the Senate to a 49-49 lockup, which meant Vice President Richard Cheney had to be on call to settle ties. Then, in 2008, when the Democrats took control of the White House and the Senate, Pelosi was central to driving through Obama’s agenda.

Even after Republicans regained control of the House in the 2010 midterms, Pelosi has been a relentlessly successful minority leader, who in key budget votes partnered with House Republican leadership to pass their deals with the president–when House conservatives voted the other way.

The key to Pelosi’s success is her skill whipping votes–using the time-tested tactic of first collecting more commitments than she needs, while promising to release certain members from their commitments once she has the votes to win and she can spare members political risk. Because her members trust her to release them if they are not needed, they give their commitments, knowing that when they do take a political risk, Pelosi will remember what they did when it comes time to release commitments on something else.

Obama said Sunday in Peru that he recognizes his debt to Pelosi’s work on his behalf on Capitol Hill.

“Much of what we accomplished was accomplished because of her smarts, her tenacity, her legislative skill,” he said.

“She does stuff that’s tough, not just stuff that’s easy,” the president said.

“She’s done stuff that’s unpopular in her own base because it’s the right thing to do for the American people. I think she’s a remarkable leader.”