WASHINGTON — It was Secretary of State Rex Tillerson’s bad luck that he was in Europe meeting with dozens of U.S. allies last week when President Trump announced formal U.S. recognition of Jerusalem as the capital of Israel, a move that angered much of the world.

Tillerson, who wound up a five-day, four-city, three-country tour on Friday, got an earful from one foreign minister after another. The Jerusalem decision announced Wednesday was opposed by nearly every U.S. ally — except Israel — as well as by Russia and the Arab and Muslim world.

The ultimate status of the contested city “must be the subject of discussion between Israelis and Palestinians,” said French President Emmanuel Macron, one of the friendlier leaders Trump has gotten to know. Macron spoke Friday at a ceremony in Paris with Tillerson in the audience.

Speaking to reporters later, Tillerson tried to stress areas of general agreement, such as the dangers posed by a nuclear-armed North Korea and the importance of fighting terrorism. But he had to admit he had faced what diplomats politely call “candid” discussions.

Of the French, he said, “On almost all things, we agree, but on those that we don’t, we are very open to express those disagreements, and I think both of us benefit from the richness of those discussions.”

Tillerson is generally unflappable, at least in public, and he made the trip days after multiple White House leaks indicated Trump was planning to replace him in the new year. Perhaps as a result, Tillerson appeared to take the criticism from foreign leaders in stride.

After Trump announced U.S. recognition of Jerusalem as Israel’s capital and ordered the State Department to start making plans to move the embassy there from Tel Aviv, a White House official told The Times that Tillerson had argued against such a move during discussions at the White House.

Tillerson was said to have argued that he agreed in principle that Jerusalem was Israel’s capital. But he said making that pronouncement, which ran counter to decades of U.S. policy and international consensus, deprived Washington of its ability to serve as an honest broker in any future peace talks in the Israeli-Palestinian conflict.

When Trump rejected that view, Tillerson publicly supported the president — although he appeared less than enthusiastic.

He urged the public to listen to the entire speech, both to what was said and what was not said. For example, he noted, Trump did not refer to Jerusalem as Israel’s “undivided” capital, as many Israeli Jews do. And he made clear his decision did not presume to set the city’s borders for the future.

That left open possible diplomatic wiggle room for eventually ceding part of the ancient city to the Palestinians, who claim East Jerusalem as their capital in a future independent state.

Trump also said he would support a two-state solution, assuming the Israelis and Palestinians do. Earlier this year, he appeared to jettison that proposal, which long had been the linchpin of U.S. and international peacemaking efforts.

During the week, Tillerson met with European Union and NATO allies in Brussels and Vienna and went to Ramstein Air Base in Germany for a briefing from U.S. military commanders who oversee counter-terrorism and other operations in Africa, ahead of the secretary’s planned trip to that continent early next year.

Except for the U.S. air base, by all accounts Tillerson got a chilly reception just about everywhere he went.

“A way must be found through negotiations to resolve the status of Jerusalem as a future capital of both states,” Federica Mogherini, the European Union’s de facto foreign minister, said as she stood beside Tillerson in Brussels a few hours before Trump’s announcement.

Tillerson’s aides acknowledged his welcome at times could have been warmer. “Allies have been very frank in sharing some of their views,” senior advisor R.C. Hammond said. “Dialogues only work if they go two ways.”

Jerusalem was only the latest irritant in U.S. relations with traditional allies in Europe.

Much of the continent disagrees with Trump’s decision to tell Congress that he could not certify Iran’s compliance with the 2015 nuclear arms control deal, even though the United Nations nuclear watchdog agency says Iran is meeting its nuclear obligations.

Allies also were stunned by Trump’s decision to pull the United States out of the landmark Paris climate accord — it is now the only country in the world that is not part of the pact.

British Prime Minister Theresa May was harshly critical of Trump’s retweeting of three anti-Muslim videos recently. The videos were originally tweeted by a British ultranationalist fringe group.

In response to Trump’s decision on Jerusalem, the U.N. Security Council held an emergency session on Friday. Britain, one of America’s closest allies, made its views clear.

“The United Kingdom does not agree with the U.S. position on this issue,” said the British ambassador to the U.N., Matthew Rycroft. “Our view is that the final status negotiations are the place to decide between the Israelis and the Palestinians on the important questions, including on Jerusalem.”

tracy.wilkinson @latimes.com