President Donald Trump’s Sunday address in Saudi Arabia was bound to inspire comparisons to the speech Barack Obama delivered in Cairo, Egypt at a similar point in his young presidency. And just like his predecessor, Mr. Trump expressed gratitude and respect for his hosts. But the 45th U.S. President quickly made clear that he did not fly to the Middle East on his first overseas trip in order to explain what’s wrong with America.

It would be a crude overstatement to say that the message has gone from America worst to America first in one presidency. Mr. Obama did speak favorably of his country several times during his Cairo address. But the difference between Barack Obama’s speech in 2009 and the Trump remarks on Sunday in Riyadh is striking.

In 2009, Mr. Obama started out by making the case why Muslims should view his country with distrust:

We meet at a time of great tension between the United States and Muslims around the world -- tension rooted in historical forces that go beyond any current policy debate. The relationship between Islam and the West includes centuries of coexistence and cooperation, but also conflict and religious wars. More recently, tension has been fed by colonialism that denied rights and opportunities to many Muslims, and a Cold War in which Muslim-majority countries were too often treated as proxies without regard to their own aspirations. Moreover, the sweeping change brought by modernity and globalization led many Muslims to view the West as hostile to the traditions of Islam.

Later, Mr. Obama faulted the United States for overreacting to 9/11 and noted that he had ordered the closing of the prison at Guantanamo Bay by early 2010—a promise he would not fulfill. Mr. Obama also sought to make sure that the U.S. received an ample share of the blame for its poor relations with one of the world’s primary sponsors of terrorism:

For many years, Iran has defined itself in part by its opposition to my country, and there is in fact a tumultuous history between us. In the middle of the Cold War, the United States played a role in the overthrow of a democratically elected Iranian government. Since the Islamic Revolution, Iran has played a role in acts of hostage-taking and violence against U.S. troops and civilians. This history is well known. Rather than remain trapped in the past, I’ve made it clear to Iran’s leaders and people that my country is prepared to move forward.

Even on issues of women’s rights, Mr. Obama didn’t want to give the U.S. much credit in comparison to the Muslim world. The latter is a world where women sometimes struggle just for the freedom to read books or drive automobiles. But Mr. Obama said that “the struggle for women’s equality continues in many aspects of American life, and in countries around the world.”