President Trump and French President Emmanuel Macron conclude a news conference at the White House on Tuesday. (Andrew Harnik/AP)

FRENCH PRESIDENT Emmanuel Macron garnered attention in Washington last week for his ringing defense of liberal democratic values in an address to Congress and for his chummy displays of affinity with President Trump. But the real import of his visit, and that on Friday of German Chancellor Angela Merkel, lay in the substantive offers they made to Mr. Trump on transatlantic relations, trade and the Middle East. In essence, the European leaders handed Mr. Trump a road map for avoiding a string of potentially disastrous mistakes. Even if their diplomacy proves to be in vain, it was an admirable effort.

Mr. Trump is due to decide by Tuesday whether to allow steep tariffs on steel and aluminum to be applied to the European Union, a misguided measure, driven by his incomprehension of basic economics, that could trigger a trade war with America’s closest allies. Eleven days later he is due to announce whether the United States will continue to comply with the Iranian nuclear accord. A repudiation would open another major rift with Europe while inviting a crisis if Iran resumes the production of nuclear materials. The president has meanwhile declared his intention to withdraw American troops from Syria in the coming months, which would open another opportunity for Iran and endanger close U.S. allies, including Israel.

The tariffs may well go forward, and Mr. Macron said before leaving Washington that he expected Mr. Trump to “get rid of” the Iran deal “for domestic reasons.” But he and Ms. Merkel offered the president ways to avoid long-term damage. Mr. Macron spoke of “a more comprehensive deal” on Iran that would address the deficiencies of the existing pact, including its failure to curb Iranian missile development and the sunset of many of its provisions in the 2020s. Ms. Merkel suggested openness to a bilateral trade deal between the European Union and the United States.

The French president claimed one important success, in persuading Mr. Trump not to abandon Syria, but instead “to work together on [a] political road map . . . even after our war against ISIS.” If Mr. Trump indeed commits to a longer-term effort to stabilize the country, he could do more to damage Iran and its regional ambitions than with any action on the nuclear accord.

The president’s best course would be to defer a decision on the existing Iran deal while continuing to negotiate supplementary agreements with the Europeans. These could be struck outside the accord and without Iran’s consent. If Mr. Trump feels compelled to repudiate President Barack Obama’s legacy, he should mitigate the impact by forgoing the enforcement of sanctions on European companies that continue to do business with Iran. That would give Tehran an incentive to continue complying with the accord, while limiting the damage to transatlantic relations.

Mr. Macron and Ms. Merkel extended themselves politically to reach out to Mr. Trump, who is deeply unpopular in their countries. That they did so is a recognition not only of the degree to which Europe still depends on its alliance with the United States — Ms. Merkel said it is of “existential importance” — but of their hope to salvage the values-based international system that the United States helped to create. To do so, they will need to coax cooperation from one of the greatest threats to that order; that would be Mr. Trump.