President Obama and German Chancellor Angela Merkel smile during their news conference at the German Chancellery in Berlin on Nov. 17. (Kevin Lamarque/Reuters)

President Obama and German Chancellor Angela Merkel on Thursday issued a joint defense of strong American leadership in global security, free trade and combating global warming while cautioning against cozying up to Russia, in what appeared to serve as a message to President-elect Donald Trump.

Eight years after his massive rally in Berlin turned Obama into a global phenomenon, he wrapped up his final official visit to Europe on Thursday with a plaintive warning to Western democracies at a time of rising populism. Do not, he said, “take for granted our system of government and our way of life.”

He conceded things left undone — saying it would be “naive” to envision a breakthrough in Syria’s raging civil war before he relinquishes the White House. But, speaking to reporters beside a woman described as his closest European ally, Obama said he remained “optimistic” about Trump’s presidency, despite having sharply criticized him during the long, bitter election campaign.

Yet Obama also drew a stark picture of a world without even-handed U.S. leadership — a world in which a divided United States would lose its way and disengage.

The United States is “the voice that insists on rules and norms governing international affairs, the voice that helps to steer the world away from war wherever possible; that’s our voice more often than not,” Obama said. “And we’re not always successful, but if that voice is absent or divided, we will live in a meaner, harsher and more troubled world.”

During a speech in Athens Nov. 16., President Obama spoke about the importance of the democratic process, even “when you don’t get the results you want.” (The Washington Post)

Asked to weigh in on U.S. protesters turning out in cities across the nation, he said, “I would not advise people who feel strongly or who are concerned about some of the issues that have been raised during the course of the campaign, I wouldn’t advise them to be silent.”

In a sign of their close ties, Obama met both Wednesday and Thursday with Merkel, a centrist leader whom observers see as heir apparent to his legacy as the leading global advocate of liberal democracy. On Friday, the pair are set to convene with a broader group of leaders, including the heads of France, Britain, Italy and Spain at a time when the continent is unsettled by the U.S. transition of power.

One of the thorniest issues: Trump’s overtures toward a newly belligerent Russia. Obama challenged 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 said he was heartened by Trump’s recent recognition of the importance of the North Atlantic Treaty Organization. Merkel, for her part, said she recognized that Germany could contribute more toward security — an apparent response to Trump’s calls for allies to shoulder more of their own defense.

Yet ahead of their encounter with the media, the pair also delivered what appeared to be a joint rebuttal to Trump’s most populist foreign policy pledges. They never mentioned Trump by name, but called in a joint op-ed article published in the German weekly WirtschaftsWoche for more transatlantic cooperation on a range of issues including free trade, security, climate change and fighting inequity and intolerance.

Merkel’s Germany may have a big bridge to build to meet Trump halfway. On the campaign trail, Trump derided her open-door policy on refugees, saying it was “ruining” Germany. Foreign Minister Frank-Walter Steinmeier — poised to win the German presidency next year — has described Trump as a “hate preacher.” And while global leaders appear to be rushing to congratulate Trump, Merkel, considered the European Union’s most influential leader, is taking a cooler approach.

She reiterated her belief Thursday that the U.S. relationship was the cornerstone of Germany’s strategic future. But as she did in an earlier note to Trump, she cautioned that cooperation should be based on “a common platform of democracy, freedom, advocacy for human rights all over the world and championing the open and liberal world order.”

Obama and Merkel said Thursday that globalization and rapid advances in technology have left voters behind in both their nations, but they argued that there is no going back to “pre-globalization” times. They condemned the march of populism on both sides of the Atlantic, with Merkel defining it as “people looking for simple or negative answers.”

Obama also took aim at the spread of false news, a subject of increasing scrutiny in the United States and overseas.

“There’s so much active misinformation,” Obama said, adding, “It’s packaged very well and it looks the same when you see it on a Facebook page or you turn on your television.”

For Obama, Merkel is something of a political soul mate. No other world leader so closely matches Obama’s ideology of tireless diplomacy with an emphasis on human rights, tolerance and equality. Sharing similar temperaments, Merkel and Obama forged a friendship that helped broker several major agreements — including a deal to curb Iran’s nuclear program and sanctions against Russia for its annexation of Crimea and intervention in eastern Ukraine.

Merkel has not yet said whether she will seek reelection in national elections next year, but the RND newspaper network, citing unnamed party sources, reported Thursday that she would announce her decision Sunday. Some of her close allies have suggested she will run.

Describing their ties as a “friendship,” Obama joked that if he were German, he “might vote” for Merkel, whom he flatteringly described as “tough.” When he suggested he might come back as a private citizen to attend Oktoberfest, Merkel replied, deadpan, “Well, we have freedom of movement.”

It is perhaps fitting that Obama bids farewell to Europe in Germany, the nation where his outdoor rally as a candidate in 2008 inspired millions. Although he has had ups and downs with the public here, Germans appeared to turn nostalgic during his last trip.

“Looking back, it now slowly sinks in that we fared very well with Obama,” the Leipziger Volkszeitung newspaper said in an editorial Thursday.

“Yes, he got the Nobel Peace Prize far too early. He didn’t shut Guantanamo. He couldn’t pacify Syria. But still this president had an important impact on the relationship with Europe. . . . He actually practiced the ‘common leadership’ that his predecessors only spoke about in abstract terms.”

Nakamura reported from Washington. Stephanie Kirchner in Berlin contributed to this report.