“With friends like that, who needs enemies.”

That was how Donald Tusk, one of the European Union’s top officials, took President Trump to task on Wednesday, offering the latest look at how the Continent’s leaders are trying to come to terms with the United States’ shifting policy on issues like the Iran nuclear deal.

Mr. Tusk, president of the European Council, which represents the European Union’s heads of government, used 280 characters on Twitter not only to rebuke Mr. Trump’s head-snapping policy decisions but also to reaffirm the bloc’s commitment to its own agenda.

“We realize that if you need a helping hand, you will find one at the end of your arm,” Mr. Tusk wrote.