People outside the U.S. hate Trump. Will they punish their leaders for working with him?

Pity the leaders of U.S. allies. They must please two very different audiences: Donald Trump, the thin-skinned president of the global superpower, and their own publics, who largely detest that man. (A poll conducted in 45 countries during the presidential campaign found that, in every single U.S. ally, the public favored Hillary Clinton over Trump.) Kowtow to Trump, and while you may spare your country an angry tweet or a new tariff, you risk domestic disapproval for refusing to echo your voters’ contempt. Stand up to him, and you could damage your country’s most important bilateral relationship.

After Trump’s election, the chief fear among U.S. allies was that he would prove neglectful — that he would unravel NATO, cut Asian partners loose and otherwise unnerve America’s many friends. But after 100 days in office, his words and deeds suggest that the U.S. alliance system will remain intact. Now, the biggest problem is not that Trump is spurning allies; it’s that, from Canberra to Berlin, they fear that working with him is political poison. During the presidencies of Richard Nixon and George W. Bush, nations faced similar dilemmas, but given Trump’s known susceptibility to ingratiation and penchant for revenge, never before have they had to tread so carefully.

Just ask Mexican President Enrique Peña Nieto. Last August, even as Trump was bashing Mexicans on the campaign trail, Peña Nieto hosted the candidate in Mexico City, hoping to stake out a patch of common ground on bilateral issues. But instead of rewarding their president for his diplomatic outreach, Mexicans — some of whom had taken to whacking piñatas made in Trump’s likeness — condemned Peña Nieto for legitimizing their tormenter. Adding to the humiliation, just hours after Trump returned from Mexico City, he gave a fiery speech on immigration in which he doubled down on his pledge to build a border wall. So intense was the political fallout that Peña Nieto’s closest ally — Luis Videgaray, the finance minister who engineered Trump’s visit — was forced to resign. Already deeply disliked because of various scandals and economic woes, Peña Nieto saw his approval rating fall to 12 percent, a historic low.

After Trump was inaugurated, Peña Nieto again elevated bilateral cooperation above political expediency. He put Videgaray back in his cabinet as foreign minister, hoping to take advantage of the MIT graduate’s extensive U.S. contacts, and planned a trip to Washington. But the week before the visit, Trump signed an executive order laying the groundwork for a border wall and reiterated that Mexico would pay for it. The insult was too much, and Peña Nieto stayed home.

Japan, too, found itself in Trump’s crosshairs during the campaign — in its case, for alleged free-riding — but the Japanese have given their leader far less grief for sucking up. Prime Minister Shinzo Abe perceived that flattery goes a long way with Trump. (It certainly worked for Vladimir Putin.) Just nine days after the election, Abe became the first foreign leader to meet the president-elect when he made the pilgrimage to Trump Tower in New York. There, he presented Trump with an offering: a $3,800 golf driver inlaid with gold. Back in the United States in February, Abe suffered through a 19-second handshake with the president and spent the weekend golfing with him at a Trump-owned course in Florida. In the end, Abe got what he had come for: a public reaffirmation of the U.S. commitment to defend Japan.

Trump is profoundly unpopular among Japanese; they preferred Clinton over him 60 percent to 3 percent. But recognizing that their country is entirely dependent on the United States for its defense against China, they appreciated Abe’s outreach. Newspapers celebrated his “home run,” and one poll found that 70 percent of Japanese approved of how Abe handled the visit. (It probably helped that, unlike with Mexicans, Trump never accused them of being rapists.)

Other heads of state don’t have the luxury of such understanding publics. In late January, British Prime Minister Theresa May went to the White House, where she complimented Trump on his “stunning election victory,” extolled the “special relationship” between their two countries and announced that Trump had accepted Queen Elizabeth II’s invitation for a state visit to the United Kingdom. She left clutching Trump’s hand.

Later that day, Trump signed his travel ban — controversial in the United States, radioactive in Britain. Initially refusing to condemn it, May eventually relented under criticism, calling it “divisive and wrong.” But by then, a petition to rescind the invitation to Trump (“because it would cause embarrassment to Her Majesty the Queen”) had garnered 1.8 million signatures, and protesters had assembled outside No. 10 Downing Street. Members of Parliament, including fellow Tories, raked her over the coals for what they saw as her excessive deference, but she has managed to put the controversy behind her.

World leaders have found more success keeping a safe distance. Trump called German Chancellor Angela Merkel a “catastrophic leader” during the campaign; she, in turn, made a thinly concealed jab at him in a statement after his election, promising to cooperate with the new president only on the basis of their countries’ shared liberal values. Just 15 percent of Germans consider Trump “competent,” which could be problematic for Merkel, who has to play nice with her country’s biggest export market. At the White House, she affected an air that the German newspaper Süddeutsche Zeitung characterized as “not warm, but not distant.” And this past week, on a panel in Berlin, she sat silently as a crowd booed Ivanka Trump for praising her father. German voters will decide in September whether to anoint Merkel to a fourth term, and for now, she is leading the polls.

Ireland’s prime minister, Enda Kenny, tried a Merkel-esque tactic during his St. Patrick’s Day visit to the White House. Beforehand, nearly one-third of the Irish public thought Kenny should cancel the visit, a remarkable level of opposition to a custom dating back to President Dwight Eisenhower. So Kenny, following the advice of some of his supporters, used his time with Trump to lecture him on immigration. He was praised more abroad than he was in Ireland.

Canadian Prime Minister Justin Trudeau has also proceeded with caution. Trudeau, under pressure to carry the banner of liberalism in the Trump era, has recognized that Canada’s interests are simply too intertwined with those of the United States for him to speak out. After Trump’s victory, in an effort to maintain good relations with Washington, he appointed a new foreign minister, replacing a hard-left climate wonk with a savvy former journalist and onetime New Yorker, and handing her the Trump portfolio. And when Trump announced the travel ban, Trudeau bit his tongue, choosing instead to highlightCanada’s more-welcoming approach to refugees.

When Trudeau arrived at the White House, his greeting embodied his strategy: He smiled and shook Trump’s hand, but with a deft grab of the shoulder, he resisted the president’s efforts to draw him closer. Asked by a reporter about Trump’s refugee policy, he refused to take the bait, saying, “The last thing Canadians expect is for me to come down and lecture another country on how they choose to govern themselves.” Two-thirds of Canadians surveyed approved of Trudeau’s comportment, and the Toronto Star ran a front-page article quoting a body language expert endorsing the handshake jujitsu.

Perhaps Trudeau wishes he had gone in for the hug, however. This past week, Trump vowed to fight Canada’s dairy and lumber protectionism, stoking fears of a trade war. “Everyone thinks of Canada of being nice, but they’ve outsmarted our politicians for many years,” he told farmers at the White House. So far, Canadians aren’t blaming Trudeau.

But even politicians whose constituents appreciate the line they are walking pay a political price. That’s because the exigencies of bilateral cooperation rob them of the anti-Trump language their rivals are free to employ. When Australian Prime Minister Malcolm Turnbull refused to condemn Trump’s travel ban, Bill Shorten, the head of the opposition, pounced, saying, “It’s time for leadership.” (It didn’t help when, a few days later, Trump berated Turnbull over the phone.) Martin Schulz, Merkel’s chief competitor, has called Trump “un-American.” Tom Mulcair, the leader of Canada’s social-democratic party, has labeled him a “fascist.” The epithets play well to a crowd, and it’s hard to imagine them coming from the mouth of someone who has to work with Trump.

In effect, the Trump era has given opposition leaders around the world an unfair advantage. When Mulcair confronted Trudeau in Parliament for refusing to denounce the travel ban, the prime minister pointed out that unlike Mulcair, he had a “double role.” Or, as May quipped when Jeremy Corbyn pursued the same line of argumentation, “He can lead a protest; I’m leading a country.”

Could Trump’s toxicity tip elections? It would be arrogant to assume that U.S. relations will dominate any foreign campaign, but on the margins, various races could see a Trump effect. Corbyn might needle May about Trump in debates before the elections in June. In New Zealand, one columnist predicted that Prime Minister Bill English’s equivocations over Trump could cost him the election scheduled for September. In Germany, it’s conceivable that Schulz’s ability to energize voters with his anti-Trump rhetoric could give him the edge over Merkel.

The clearest impact can be seen in Mexico. The early favorite in the presidential election scheduled for next year is Andrés Manuel López Obrador, a left-wing populist whose success derives in part from his willingness to insult Trump, raising the prospect of a less-friendly government on America’s southern border.

Short of deciding elections, Trump’s distortionary effect on politics can still set back U.S. interests. Twice burned, Peña Nieto could attempt to preserve his party’s reputation by reducing cooperation on migration from Central America, drug trafficking and counterterrorism. In Australia, Turnbull, not wanting to look impotent, could withhold help ensuring freedom of navigation in the South China Sea. And if Emmanuel Macron wins the runoff in France, he, too, will face pressure to publicly prove his anti-Trump bona fides — by, say, shifting resources toward European Union defense capabilities and away from NATO.

Even countries with their own nationalist goals could come into conflict with Trump. An America-first agenda, for example, would logically prioritize trade and military ties with the E.U. over the U.S.-British relationship, since the former are far more valuable than the latter. Likewise, even though Trump congratulated Turkish President Recep Tayyip Erdogan for winning a referendum that solidified his authoritarian rule, the two could easily clash over their divergent views on Syria, where, to Erdogan’s great dismay, the United States backs Kurdish forces that Turkey sees as a threat.

Heads of state looking for a way out of the dilemma should take comfort that over time, the constraints should slacken. As his wings get clipped at home, and as the ideologues in his administration lose power to the quasi-professionals, Trump is looking less menacing abroad. Soon, perhaps, foreign leaders will be able to rip off their muzzles and give the people what they want.