IT WAS a friendly, local political event: a sweaty tent at a street festival in Munich on a Sunday afternoon. Angela Merkel arrived to a brass-band serenade and battled her way through the beery crowd to reach the podium. But her speech on May 28th made global news. Alluding to America and Britain, the chancellor said: “The times in which we could totally rely on others are to some extent over, as I have experienced in the past few days.” To prolonged cheers she added: “We Europeans must really take our fate into our own hands.”

This followed NATO and G7 summits at which Donald Trump offended European sensibilities. The president attacked the continent’s leaders for (mostly) failing to meet the alliance’s target for defence spending of 2% of GDP, and pointedly neglected to mention Article 5, NATO’s mutual-defence clause. In one meeting he reportedly called Germany “bad, very bad”, and threatened tariffs on the country’s car exports to America. Mrs Merkel was venting her irritation. It was a risky move.

The chancellor is not prone to spontaneous outbursts. Her comments had been planned, and were aimed at German voters. Her Christian Democrats (CDU) have a comfortable double-digit lead in polls ahead of the general election on September 24th. But she remembers the 2002 and 2005 election campaigns, when Gerhard Schröder, the Social Democratic (SPD) incumbent, picked off CDU voters by opposing George W. Bush’s wars. Ulrich Speck, an expert on German foreign policy, says Mrs Merkel learned that “during election campaigns, alignment with a right-wing American president is toxic.”

Europe’s anti-Americans could hardly design a president more favourable to their cause than Mr Trump. His disregard for the environment, his unilateralism, his materialism and his physical impoliteness raise the costs to European leaders of defending the transatlantic alliance. Mrs Merkel’s SPD rival, Martin Schulz, is romantically pro-European, rails endlessly against Mr Trump and opposes NATO’s 2% target. She needs to cover that flank—especially ahead of the G20 summit in Hamburg next month, which Mr Trump will attend.

The result has been a rhetorical arms race. On May 26th Mr Schulz thundered of Mr Trump: “I furiously reject the way this man takes it on himself to treat the head of our country’s government.” Sigmar Gabriel, the SPD foreign minister, said he had “weakened the West” and accused him of endangering the environment, peace and religious harmony. The following day Mr Trump tweeted of Germany’s trade surplus and low defence budget: “Very bad for US. This will change.” As the German election campaign approaches in September, people should expect “anti-Trumpism morphing into outright anti-Americanism”, warns Thorsten Benner of the Global Public Policy Institute in Berlin.

France’s new president, too, is showing that he wants to stand up to Mr Trump ahead of legislative elections on June 11th and 18th. At the NATO summit Mr Macron pointedly greeted Mrs Merkel first. In a separate encounter he gave Mr Trump a white-knuckle handshake. This show of force was “not accidental”, he later admitted. At a meeting near Paris on May 29th he confronted Vladimir Putin about the role of Kremlin-backed broadcasters in France, which he correctly called “agents of influence and propaganda”.

Yet it would be wrong to write off the transatlantic partnership. America’s military establishment still firmly supports NATO and Mrs Merkel is far from anti-American. Three days before her trip to Munich she held a fond reunion with Barack Obama in Berlin; she is said to phone Mr Bush for advice. “For Germany the transatlantic alliance is (to use a favourite Merkel term) alternative-less,” says Mr Benner. Her comments in Munich were partly aimed at convincing voters that the country needs to take its defence spending more seriously.

Exaggerating for effect

Whether they were wise is another matter. A war of words plays into Mr Trump’s belief that every deal has a winner and a loser, raising the probability of a tariff war that would hurt both sides. The president will surely continue to offend Europeans, but neither Mrs Merkel, nor Mr Schulz, nor Mr Macron believes their continent can manage without America. Europe relies on the transatlantic alliance, whether Europeans admire the inhabitant of the White House or not. Wolfgang Ischinger, a former German ambassador to Washington, says this inconvenient truth leaves Mrs Merkel and other Europeans with just one strategy: “engage, engage, engage”.