Obama visited Berlin for a conference last year and met with German Chancellor Angela Merkel. (Steffi Loos/Getty Images)
Ben Rhodes, a deputy national security adviser during the Obama administration, is author of "The World as It Is."

On his final foreign trip as president, Barack Obama met allies shellshocked and uncertain about what was going to happen to the United States, and the world, with Donald Trump taking office. In Berlin, German Chancellor Angela Merkel told Obama she was likely to seek another term, in part to defend the liberal international order.

After saying a last goodbye, Obama lamented to me about his closest partner in the world: “Angela, she’s all alone.” In their final meeting, Canadian Prime Minister Justin Trudeau told Obama that he was prepared to extend a hand to President-elect Trump but that he was also prepared to assume a higher profile on the world stage if necessary. “You’re going to have to speak out,” Obama told him, “when certain values are threatened.”

What went unspoken was the strange possibility that democratic values might no longer have an advocate in the White House. We have now received repeated and definitive proof that they don’t.

With the 5-to-4 decision upholding Trump’s Muslim ban, arbitrary discrimination is now formal U.S. policy, celebrated by a president who campaigned on a “total ban” of Muslims entering the United States. A nation that has been a model for religious freedom has now become a model to nationalists around the globe who reject refugees and seek legitimacy on racial or ethnic grounds.

This comes on the heels of state-sponsored cruelty on our southern border. Consider, for a moment, how these images were consumed around the globe: From Berlin to Moscow, from San Salvador to Manila, people watched as children were ripped away from their parents. It was a scene you might expect to see in a fragile state teetering on the edge of dictatorship. “The pictures of children being held in what appear to be cages are deeply disturbing,” said conservative British Prime Minister Theresa May. “This is wrong.”

The dizzying nature of the Trump presidency can make it hard to stitch together disparate threads. But recent events illuminate an overarching picture: an abdication of American leadership and betrayal of democratic values that has been accelerating since January 2017, tearing at the seams of the liberal international order that the United States has led for more than 70 years.

First, President Trump is eviscerating American credibility by pulling out of international agreements and organizations such as the Trans-Pacific Partnership, the Paris climate accord, the Iran nuclear deal and the United Nations Human Rights Council. Going forward, other nations will think twice about working with the United States in building and formalizing the type of cooperation that we used to lead, making it harder to achieve Trump’s stated objective of burden sharing. Our credibility is further undercut when repackaged North Korean commitments to denuclearize are celebrated as historic breakthroughs.

Second, Trump is doing serious damage to our alliances. In addition to deep divisions on issues such as trade, climate change, Middle East peace and nuclear weapons, Trump’s attacks on leaders such as Trudeau and Merkel and disrespect for NATO and other institutions are prompting a reassessment by allied governments and publics. Trump polls at only 11 percent in Germany, and global opinion favors China over the United States. The result will likely be Europe and other allies operating independently of the United States and — in some cases — working around us.

American jobs will be lost as nations forge trade deals without us. Russia will try to intimidate European countries that are less confident in our protection. China will try to drive wedges between us and our Asian allies. And if there is a crisis that demands collective action — such as the Ebola outbreak that threatened to take millions of lives in 2014 — it will be harder to rally a coalition of countries to respond.

Third, Trump has flipped the script of the American presidency by advocating for authoritarian leadership. By heralding President Xi Jinping’s accession to permanent leadership, soliciting Vladimir Putin’s reentry into the Group of Seven and declaring that Kim Jong Un is “beloved by his people,” Trump legitimizes the very behavior that U.S. presidents opposed for decades. While these statements seem like just more reality-show absurdities at home, they aren’t portrayed that way on authoritarian state-run media abroad. Just imagine how Trump’s words of praise for Kim Jong Un sound in a North Korean gulag.

Finally, Trump is sacrificing the most indispensable aspect of American leadership: the power of our example. Irrespective of our foreign policies, for decades other nations and peoples could see, in the United States, a strong democracy that could maintain social cohesion, welcome immigrants of all backgrounds and count on stable institutions. Now, America offers an example of political chaos: a president who attacks a free press, actively works to undermine the rule of law, singles out Muslims for exclusion from our country and gleefully stokes racial and ethnic tensions — from the sidelines of the NFL to his response to Charlottesville to the southern border.

In the context of American politics, there is a tendency to see the Trump presidency as an assault on Obama’s legacy. But mere animus to your predecessor’s success is not a guiding principle, and Obama was not the extremist that many Republicans declared he was. Indeed, by choosing to caricature Obama as so far outside the mainstream, the Republican Party opened the door to the actual extremism that we see today. What may fill airtime on Fox News at home projects a message of insecurity and incoherence abroad.

Looking back on that final foreign trip with Obama, it is now clear how much other leaders saw this coming. In his final meeting with Xi, Obama urged the Chinese leader to give the new American president a chance. Xi appeared relaxed, far less concerned about what was to come than the leaders of our democratic allies had been. Instead, he offered a warning that is chilling today, responding to Obama with a simple message: If an immature leader throws the world into chaos, Xi said, the world will know whom to blame.