Russian President Vladi­mir Putin and President Obama spoke briefly before the Asia-Pacific Economic Cooperation summit in Lima, Peru. (Presidency of Peru via European Pressphoto Agency)

President Obama spent the last day of his final foreign trip attempting to make headway on one of the most painful aspects of his foreign policy portfolio: the ongoing civil war in Syria.

Just before the Asia-Pacific Economic Cooperation summit opened its first formal session Sunday, Obama spoke briefly with Russian President Vladimir Putin, who was standing by his seat at a massive circular table around which all the participants were arrayed.

The four-minute discussion, which a White House official described as “brief and informal,” represented the first time the leaders had spoken in person since members of the Group of 20 convened in China in September.

“I am not optimistic about the short-term prospects in Syria,” Obama told reporters Sunday. Once Russia and Iran decided to back Syrian President Bashar al-Assad in a brutal air campaign, “then it was very hard to see a way in which even a trained and committed moderate opposition could hold its ground for long periods of time,” he said.

The president said that his administration would continue to press for a deal to stop the killing in the rebel holdout of Aleppo, but he displayed little optimism.

“We’re just not getting help or interest from those parties that are supporting Assad,” he said.

Obama’s tone was serious and even slightly melancholy when he spoke of the United States’ role on the world stage and the advice he would give President-elect Donald Trump. Trump at times has spoken of scaling back U.S. commitments overseas and making allies share a larger portion of the burden of working toward world peace.

“The United States really is an indispensable nation in our world order,” Obama said. If the United States does not play a central role in fighting pandemics, countering aggression, managing global institutions and speaking up for human rights, Obama warned, the world will become far more dangerous.

“Then it collapses, and there’s no one to fill the void,” he said of the post-World War II order. “There really isn’t.”

Obama’s remarks came against the backdrop of more bloodshed in Aleppo. On Saturday, Syrian warplanes launched strikes there that killed at least 20 people. Meanwhile, Russia announced the same day that it was launching an offensive in the northern rebel-controlled Idlib province as well as in central Syria’s Homs province.

“Beyond pleasantries, the president urged President Putin to uphold Russia’s commitments under the Minsk agreements, underscoring the U.S. and our partners’ commitment to Ukraine’s sovereignty,” said the official, who spoke on the condition of anonymity to discuss diplomatic matters. “On Syria, the president noted the need for Secretary [of State John F.] Kerry and Foreign Minister [Sergei] Lavrov to continue pursuing initiatives, together with the broader international community, to diminish the violence and alleviate the suffering of the Syrian people.”

But there is little prospect that much will change even though Obama and his top aides have been sharply critical of Russia’s support for Assad and the atrocities he has carried out in Aleppo, where about 275,000 people still remain. Trump has spoken much more favorably about Putin and Assad, and has said the fall of Aleppo is inevitable.

“Putin no longer has a reason to negotiate with president Obama and instead will look for better terms on Syria from President Trump,” Ilan Goldenberg, who directs the Middle East Security Program at the Center for a New American Security, said in an email. “For the next two months, the Russians will ignore American and international entreaties and work with Assad and the Iranians to do all they can to pulverize Aleppo and destroy the Syrian opposition.”

On Saturday, national security adviser Susan E. Rice condemned the fact that all remaining hospitals in eastern Aleppo, as well as several staging locations for first responders, have been destroyed in attacks by forces loyal to Assad.

“There is no excuse for these heinous actions,” Rice said in a statement. “For years, the United States has worked with our international partners to support their relief efforts and provide humanitarian aid to the Syrian people suffering as a direct result Assad’s war against his own people, which Moscow has aided and abetted. The Syrian regime and its allies, Russia in particular, bears responsibly for the immediate and long term consequences these actions have caused in Syria and beyond.”

Goldenberg said that although Putin is likely to lobby Trump to accept the idea that Assad should stay in power, the problem remains that the alliance of Russia, Syria and Iran “does not have the ground power to retake and hold all of the necessary territory in Northwest Syria. Instead they will destroy what is left of the acceptable opposition and drive it into the hands of extremists.”

In addition to his informal talks with Putin, Obama met one-on-one with Australian Prime Minister Malcolm Turnbull and Canadian Prime Minister Justin Trudeau.

After speaking with Turnbull, Obama said he had conveyed his confidence that there would be “a strong handoff and continuity in the next administration.”

Turnbull emphasized the views that he and Obama share, noting that “on trade we are quite of the same mind, on the importance of open markets.” He added, looking at Obama, “We want America to succeed under the next president, just as it has succeeded under your leadership.” Obama’s term ends in January, and Trump had promised on the campaign trail that he would rip up U.S. trade deals.