President Obama, German Chancellor Angela Merkel, French President François Hollande and Italian Prime Minister Matteo Renzi wait for the beginning of their meeting in Berlin on Thursday. (Kay Nietfeld/AFP/Getty Images)

President Obama departed Europe on Friday after a final round of crisis talks with U.S. allies about hot spots including Ukraine and Libya, even as he sought to ease concerns about possible policy shifts under the incoming Trump administration.

The victory of President-elect Donald Trump has startled European allies because of campaign pledges that seem to pull back from the traditional U.S. commitment to transatlantic security.

Obama urged the leaders of Germany, France, Britain, Italy and Spain to continue seeking ­solutions with the incoming administration “on the basis of the core values that define the United States and Europe as open democracies,” according to a White House statement.

Obama joined with his European counterparts in strongly supporting the North Atlantic Treaty Organization as the cornerstone of Western security, while backing their calls to uphold sanctions against Vladimir Putin’s Russia, which annexed Crimea in 2014 and is seen as aiding pro-Moscow separatists in Ukraine.

Also on the agenda was the Iraqi-led offensive to retake the northern city of Mosul from the Islamic State, as well as the resumption of attacks in Aleppo and other parts of Syria by government forces and their ally Russia.

“The president emphasized that de-escalation and a diplomatic solution to the ongoing conflict are the only viable ways to end the suffering, prevent another migration crisis, and move toward a political transition,” according to the White House statement.

Although Obama’s visit here had the usual trappings, including a group photo with the five European leaders who had converged in Berlin to meet with him, it had a more subdued tone than past ­visits. By midday, he had left the German Chancellery under a drizzle for Air Force One to head to his trip’s final stop, Peru.

The summit took shape as Europe is awash in its own tensions, over Britain’s vote to leave the European Union, differences on a defense strategy, and a rise of populist nationalism that is challenging the fortunes of several leaders across the continent.

Maintaining European and U.S. sanctions on Russia in particular remains a top concern amid signs of a possible thaw between Washington and Moscow under Trump.

This week, Trump and Putin agreed in a telephone conversation that U.S.-Russian relations were “unsatisfactory,” and they vowed to work together to improve them, the Kremlin said.

But Obama has said that the ­president-elect, in their one-on-one meeting after the election, “expressed a great interest in maintaining our core strategic ­relationships,” including with NATO.

U.S. President Barack Obama boards Air Force One as he departs Berlin. (Kevin Lamarque/Reuters)

During Friday’s talks in Berlin, Obama and European leaders “unanimously agreed” on the need to press Russia to stand by promises to help calm the conflict in Ukraine, and said that “Ukraine-related sanctions against Russia” must remain in place until it does.

In a joint news conference with Spanish Prime Minister Mariano Rajoy after the summit, German Chancellor Angela Merkel expressed impatience that peace in Ukraine is still far from reach.

“Not enough progress can be seen,” she said.

Rajoy described thriving populism as one of the most important issues confronting the European Union, acknowledging that 2017 would be a difficult election year, with nationalist forces vying for power in France, Germany and the Netherlands.

Merkel, commenting on her growing influence in the European Union and globally, said: “One person alone can never solve everything, we’re only strong together. . . . I will do what is my duty as the German chancellor, namely on the one hand to serve the people in Germany, but that includes for me to work for European unity and European success.”

Even among European powers, positions vary on Russia. Some urge warmer ties, while others are warning against cozying up to ­Putin because of the annexation of the Crimean Peninsula and the rebel clashes in Ukraine.

Speaking beside Merkel on Thursday to the media, Obama urged Trump to “stand up to Russia” at the right times.

“My hope is he does not simply take a realpolitik approach and suggest if we just cut some deals with Russia — even if it hurts people or violates international norms or leaves smaller countries vulnerable or creates long-term problems in countries like Syria — that we just do what is convenient at the time,” he said.

Obama, in talks with Merkel, conceded Thursday that it would be “naive” of him to expect a breakthrough in the Syrian conflict before he leaves office. Earlier this week, Syrian President Bashar al-Assad, speaking to Portuguese TV, opened the door to a change under Trump, whom he described as a “natural ally.” Merkel cautioned against any bargains with Assad.

“He has brought untold suffering on his people, if you look at Aleppo and other places,” she said. “When you talk to the many Syrian refugees who have fled here to Germany, they will be able to tell you their own personal story, and the majority of them — the great majority of them — fled from Assad, and most of them not even fled the Islamic State. So I don’t see him as an ally.”

The wild-card nature of Trump’s presidency is amplified in Europe by the continent’s own internal pressures. Nowhere are those tensions more on display than in the talks over Britain’s departure from the European Union. British Prime Minister Theresa May will hold a one-on-one meeting with Merkel as the Germans call for stiff penalties as the price of Britain’s exit.

Wolfgang Schäuble, Germany’s finance minister, laid out a tough bargaining position with Britain in an interview with the Financial Times. He insisted that any deal would mean that London must still pay billions into the E.U. budget beyond its exit date, perhaps stretching to 2030. He also said Britain should be prepared to see financial services industries flee London in favor of cities such as Frankfurt so that they can more easily work with the European Union.

Particularly after Trump’s election, European leaders are calling for the region to take more responsibility for its own security. This week, German Defense Minister Ursula von der Leyen singled out Britain for being obstructionist as other member states moved to forge a deeper defense alliance, including forming a possible European army.

“The biggest resistance is coming from the British,” von der Leyen told the German weekly Die Zeit. “The USA will always be our most important and closest partner, but we Europeans cannot derive our strength from America’s. . . . Europe must decide whether it wants to shape events or be a pawn.”

Underscoring the heightened concern, European officials are speaking in increasingly stark terms. Manuel Valls, France’s prime minister, issued a dire warning in the German capital on Thursday, calling for Berlin and Paris to quickly forge deals to improve economic growth and generate jobs amid strong challenges from anti-establishment nationalists.

“Europe is in danger of falling apart,” Valls said. “So Germany and France have a huge responsibility.”

Stephanie Kirchner in Berlin and Juliet Eilperin in Lima, Peru, contributed to this report.