The only solace in the current American standoff with Iran is that President Trump seems not to want to risk a war. That is of some comfort in a crisis that has left the United States looking weak and untrustworthy. But the crisis could still descend into armed conflict, and that is largely attributable to Mr. Trump’s poorly considered strategy.

That’s not to say that the repressive regime in Tehran isn’t dangerous, fueling terrorism and sectarian strife in the Middle East. But finding ways to contain such regimes without resorting to war is a central mission of American foreign policy, and the nuclear deal President Barack Obama and five other nations struck with Iran in 2015 was a model of diplomacy and coalition-building. It forestalled Iran’s nuclear arms program in exchange for lifting economic sanctions against Tehran.

It was not a perfect deal. But then no bargain between enemies with a history as deep-rooted as America’s with Iran could be. And it was not the imperfections that propelled Mr. Trump to unilaterally withdraw the United States from the treaty. Indeed, early in his campaign to put greater pressure on Iran, he created an opening to strengthen the deal and score a real diplomatic achievement. But he sabotaged that potential victory through a self-defeating fixation on undoing anything Mr. Obama accomplished and the vain illusion that his purported mastery of business negotiation would allow him to attain his maximalist vision of a deal.

The withdrawal from the agreement in May 2018 was not accompanied by any strategy save Mr. Trump’s baseless belief that “maximum pressure” — sanctions on top of sanctions — would leave Iran begging for any deal. The president even began to fantasize about a tête-à-tête with Iran’s president, Hassan Rouhani, at the annual United Nations General Assembly session, along the lines of the useless photo ops with the North Korean tyrant, Kim Jong-un, or the mooted Camp David get-together with the Taliban. The other signers of the agreement — Britain, France, Germany, Russia, China and the European Union — strongly opposed Mr. Trump’s move but eventually were unable to defy Washington’s sanctions against Iran.