What a difference a week makes. On May 19, President Donald Trump took off in Air Force One for the Middle East and Europe. He left behind a Washington and a nation buzzing about his firing of FBI Director James Comey, the multiple reasons he had given for doing so, the meeting he’d had with the Russian foreign minister a day later and his statement that Comey is a “nut job.”

The I-word — impeachment — was in the air as Democrats and mainstream media muttered that he was obstructing justice by attempting to throttle investigation of collusion with the Russians. Brainy and quirky conservative New York Times columnist Ross Douthat argued that the Trump Cabinet should remove him from office as unfit under the 25th Amendment.

So it has been something of a surprise to see the Trump who emerged from Air Force One in Riyadh behaving quite differently, like a competent American president.

In Saudi Arabia, he delivered a sobering speech that invites comparison with Barack Obama’s Cairo address to the Muslim world almost exactly eight years ago.

Obama apologized for the misdeeds of the West, ranging from the Crusades a millennium ago to 19th- and 20th-century colonialism to the overthrow of the Mosaddegh regime in Iran eight years before he was born. Trump apologized for nothing.

Instead, before an assembly of leaders from about 50 Muslim-majority nations, Trump denounced in no uncertain terms Islamic extremism and Islamic terror groups and insisted that Muslims must “drive them out” of their places of worship, communities and “holy land.”

Trump also announced a $110 billion arms sale to Saudi Arabia and denounced Iran for fueling “the fires of sectarian conflict and terror.” This presumably delighted the Saudis and the leaders of Egypt, Jordan and the Persian Gulf States, who were dismayed at Obama’s eight-year tilt toward Iran.

That started with his cold indifference to the mullah regime’s squashing of the 2009 protests and culminated in the 2015 nuclear agreement, which, as Obama adviser Ben Rhodes confessed to The New York Times Magazine, was pushed through with a false “narrative” and a compliant media “echo chamber.”

At best, the deal delayed Iran’s acquisition of nuclear arms; it has not changed Iran’s terrorist-supporting behavior as Obama apparently hoped. Trump’s turn to an explicitly anti-Iran policy may turn out better.

Trump then journeyed to Israel — on the first scheduled nonstop flight from Riyadh to Tel Aviv in history — and became the first sitting president to visit the Western Wall. In Bethlehem, at the side of Palestinian leader Mahmoud Abbas, he condemned the “evil losers” responsible for the bombing of a concert hall in Manchester, England. In Vatican City, emerging from an apparently amicable meeting with Pope Francis, Trump said, “I won’t forget what you said.”