President Trump’s European tour this week came off if not without a hitch then at least without a calamity.

Part of the reason seems to be that the president more or less muted his own megaphone. But another is that key allies appear to have settled into how they deal with Trump — avoid confronting him unless utterly necessary while keeping expectations low that he can be swayed to compromise over any disagreements.

European leaders kept the three-country trip mostly to parades and pageantry, which seemed to suit Trump and his hosts just fine, rather than view the American president’s arrival in Europe for D-Day commemorations as an opportunity to engage on policy debates.

Brian Klaas, who teaches global politics at University College London, said many European leaders are taking a “wait-and-see approach,” with the 2020 presidential election looming.

“Don’t poke the bear and hope there’s going to be a change in leadership,” he said.

World leaders found ways big and small to manage the unpredictable American president who has slapped tariffs on allies, pulled the United States out of two compacts dear to Europeans, on Iran and climate change, and said both the European Union and NATO are bilking American workers and taxpayers.

The leaders managed to avoid conflict with Trump, even on issues where they have been unmoved by his administration’s entreaties. Europe continues to pursue a 5G rollout with Huawei technology; Britain, France and Germany have led the way on trying to salvage the Iran nuclear deal and circumvent U.S. sanctions; Germany is still set on a pipeline to get natural gas from Russia; Europe remains invested in the Paris climate agreement, and Green parties did surprisingly well in recent European Parliament elections.

Trump has made inroads on one complaint — many European nations have made modest increases to their defense budgets.

The Instagram-worthy moments of the trip began with a royal welcome at Buckingham Palace on Monday, when fickle English weather cooperated long enough for marching guards and a magnificent state dinner on the good china. Trump did not insult or embarrass outgoing British Prime Minister Theresa May, as he had last year, or commit any major faux pas during his interactions with Queen Elizabeth II, whom he praised as a “great woman.”

The era of good feelings continued through the somber ceremony here Thursday marking 75 years since the D-Day invasion. Alongside French President Emmanuel Macron, Trump marveled at the might and grit of American fighting forces, and at the seemingly unending whorls of crosses and Star of David markers at the Normandy American Cemetery.

In between there was a rush-job meeting with Irish Prime Minister Leo Varadkar, who resisted Trump’s request to hold the session at a Trump-owned golf club in Ireland, and brief greetings with European, Canadian and Australian leaders who attended another D-Day commemoration Wednesday in Portsmouth.

Throughout, European leaders who had once tiptoed around the mercurial nationalist and his “America First” agenda, or were thrown by his outbursts and insults, were matter-of-fact and friendly.

When Trump said that Britain’s National Health Service would be “on the table” in a potential U.S.-Britain trade deal — a prospect that would be highly unpopular there — May did not directly contradict him.

“But the point about making trade deals is, of course, that both sides negotiate and come to an agreement about what should or should not be in that trade deal for the future,” May said during a news conference in London. (Trump later backed off the idea that health care should be part of a trade deal during a friendly interview with British broadcaster Piers Morgan.)

Trump couldn’t resist mentioning that he had advised May to “sue” the European Union to give effect to British voters’ decision to leave, advice she didn’t take. But he pivoted almost immediately, praising May for her efforts on Brexit, the issue that was her political downfall.

“She’s probably a better negotiator than I am,” Trump offered.

The queen used one of her brief public remarks with Trump, at the banquet where all his adult children scored invitations, to deliver a mild but unmistakable lesson about international cooperation and the arc of history.

“After the shared sacrifices of the Second World War, Britain and the United States worked with other allies to build an assembly of international institutions, to ensure that the horrors of conflict would never be repeated,” said the 93-year-old queen, who was 18 on D-Day. “While the world has changed, we are forever mindful of the original purpose of these structures: nations working together to safeguard a hard-won peace.”

When Trump suggested that Ireland have a “wall” to mark its border with Northern Ireland — a prospect that ginned up memories of bloody clashes between the two neighbors — Varadkar offered a swift but gentle pushback.

“The thing we want to avoid, of course, is a border wall,” he said Wednesday as the two leaders met at an airport VIP lounge in Shannon, Ireland.

Trump went along amiably.

“The way it works now is good; you want to try and keep it that way,” Trump said approvingly.

And when reporters pointed out to Trump on Thursday that he and Macron had different views about how to deal with Iran, Trump downplayed the differences — and Macron followed suit.

“I think we do share the same objectives on Iran,” Macron said during his meeting with the president in Caen.

Trump’s trip was framed around the ceremony marking D-Day, the Normandy invasion in which American fighting forces helped turn the tide of World War II and laid the foundation for a postwar order that Trump distrusts.

The central importance of the United States in international affairs and commerce dictates that European leaders find a way to deal with Trump, and they have tried just about every approach.

Many, including May, have sought to flatter the president by rolling out the red carpet and minimizing their public disputes even when he is on the attack, said Klaas.

That, he said, “hasn’t worked.”

“Flattery only gets you so far, and it’s not going to necessarily cause Trump to treat you any differently,” he said. “He might appreciate it, he might be diplomatic during the trip, but at the end of the day it doesn’t change his views toward attacking NATO, throwing British leaders under the bus when he doesn’t like what they’re doing with Brexit or slapping tariffs on allies.”

Earlier in his tenure, Macron thought he could charm and persuade Trump: first on keeping the Paris climate accord, then on preserving the Iran nuclear deal, both of which were signature policy achievements of the Obama administration. The French president failed on both counts, with Trump clearly relishing leading Macron along when he came to Washington to try to save the Iran deal.

These days, foreign policy analysts say, Macron is less ambitious. He has accepted that Trump cannot be easily swayed, but he has also not written off the possibility of cooperation with the United States.

“If I were to summarize the thinking of Macron on Trump, it would be twofold,” said Dominique Moisi, a fellow at the Paris-based Institut Montaigne think tank who advised the Macron campaign on foreign policy. “One dimension would be what I call pragmatic in the sense that [Trump] may be the next president of the United States.”

The other is that “behind Donald Trump, there is eternal America,” Moisi said, and “in a world where there is more Russia and much more China, you still need the United States.”

This view of the United States was reflected in Macron’s defense of multilateralism during his speech at the American cemetery. “The United States of America,” Macron said, “is never greater than when it is fighting for the freedom of others.”

Trump sat with his arms crossed, opening his mouth to yawn at one point as Macron continued to praise global institutions and multilateral cooperation.

Trump was generally on good behavior during his public interactions throughout the trip, though he did snipe at London Mayor Sadiq Khan on Twitter and spent considerable time cleaning up whether he had called American-born Meghan, Duchess of Sussex, “nasty.”

“You know what? She’s doing a good job. I hope she enjoys her life,” Trump told Morgan. “I think she’s very nice.”

And he seemed ready to warm the chill on his relationship with Macron.

“The relationship between you and I, and also France and the United States, has been outstanding,” Trump said Thursday. “I don’t think it’s ever been maybe as good. It’s been good sometimes, and sometimes it hasn’t been. But, right now, it’s outstanding.”

He headed home Friday after spending one more night at his golf club in Ireland where no diplomacy was required.

Olorunnipa reported from Limerick, Ireland. McAuley reported from Paris. William Booth contributed from London.