PRESIDENT TRUMP has recklessly navigated himself into a corner in the Persian Gulf. Though he campaigned against Middle East wars and has repeatedly said he does not want one with Iran, Mr. Trump has ordered a series of provocative actions toward the Islamic republic that, on Thursday, produced the entirely predictable images of oil tankers burning near the Strait of Hormuz — and the very real danger of escalation toward armed conflict.

Mr. Trump blames Iran for the attacks, which U.S. officials say involved attaching underwater mines to the ships; the U.S. military released video appearing to show an Iranian craft removing an unexploded mine from one of the vessels. In fervently denying responsibility, the Iranian government is taking advantage of the shattered credibility of a U.S. president who has been caught in thousands of lies. But it appears likely that Tehran was responsible for the attack and for another strike against ships in the Gulf of Oman last month; the regime of Ayatollah Ali Khamenei has threatened just such action in the past.

Iran is responsible for aggression across the Middle East, against which the United States ought to push back. But the ship attacks were the foreseeable result of Mr. Trump’s campaign to apply “maximum pressure” on the Islamic republic without any accompanying diplomacy. After unwisely withdrawing from the nuclear deal with Tehran struck by the Obama administration, which had restrained Iran’s most dangerous threat to the United States, Mr. Trump ratcheted up sanctions — including, in April, a move to shut down Iran’s remaining oil exports.

The only peaceful avenue that Mr. Trump offered out of this economic vise was the acceptance by the Khamenei regime of a dozen U.S. dictates that would completely reverse its foreign policy. Secretary of State Mike Pompeo, who laid out the demands, himself conceded they would not lead to any diplomatic agreement; instead, Mr. Pompeo speculated, “what can change is, the people can change the government.” Under these circumstances, it’s no surprise that Iran would respond with actions aimed at punishing the United States — such as disrupting the vital oil trade through the Persian Gulf — while avoiding the direct attacks on Americans that might provide the White House with a casus belli.

Mr. Trump sounds sincere when he says he doesn’t want a war, but he doesn’t have an easy way out of the crisis he has created. Mr. Khamenei on Thursday rejected negotiations with the United States, prompting the president, who had repeatedly said he wanted such talks, to rule them out himself on Twitter. The administration will seek to enlist European allies to join it in confronting Iran over the ship attacks, but the Europeans will inevitably be wary, given that Mr. Trump withdrew from the Iran nuclear deal and reapplied sanctions over their strong objections. Meanwhile, barring another escalation by Iran, Congress may not support U.S. military action.

The administration is talking about steps short of that, such as providing U.S. naval protection to ships transiting the gulf. But Iran will likely continue to seek ways to inflict pain on the United States and allies such as Saudi Arabia and Israel. If Mr. Trump genuinely wishes to avoid further escalation, he should pursue a credible diplomatic outreach to Iran, perhaps in concert with the Europeans — and he should set goals that are achievable. De-escalation by both sides would be a good start.

Read more: