After the killing of Maj. Gen. Qassem Soleimani, Iran’s military and terrorist mastermind, Iranian leaders vowed to retaliate against the United States. And they did, firing 16 missiles at two bases housing American troops in Iraq. No U.S. soldiers were killed, though several missiles came close. But an Iranian official said his country had not sought American casualties. It looked like Iran had blinked in its latest confrontation with the U.S.

Meanwhile, President Trump announced toughened sanctions against Iran, whose economy had already been devastated by earlier sanctions. Iran also got bad news from Britain, France, and Germany, which threatened sanctions of their own unless Iran stopped violating the 2015 nuclear deal.

There’s an unavoidable conclusion in all of this: advantage Trump, Iran’s chief foe. The president’s critics had been surprised by two of his actions. The first was what the president called the elimination of “the world’s top terrorist.” He followed that by changing his strategy. He advocated “a deal with Iran that makes the world a safer and more peaceful place.” Rather than war, he called for a halt to the U.S.-Iran conflict and said he wants Iranians to “thrive and prosper.”

Is a deal possible? Trump has asked for negotiations with Iran before. Iran wasn’t interested. But Ayatollah Ali Khamenei is desperate to avoid an all-out war with America. It would be a fight Iran couldn’t win and one in which the regime would likely be removed or destroyed.

Trump is a special problem for Iran’s leaders. He sounded warlike when he tweeted about attacking Iran’s cultural sites, but he talked like a peacemaker in his speech after the Iranian missile assault. Iranians are bound to be confused. And Trump likes it that way. As early as the 2016 campaign, he said he wouldn’t, as president, want to signal to America’s enemies what he might do next.

There is a way for the U.S. and Iran to meet and talk seriously and very privately, according to Robert Satloff, the executive director of the Washington Institute for Near East Policy. He posed this question in the Washington Post: “What if U.S. officials took advantage of the moment to ask a trusted third party — say, the Omanis or the Swiss — to test whether Tehran’s leaders were ready for a quiet diplomatic initiative to achieve what the White House has long said was the objective of its ‘maximum pressure’ campaign: a better, broader agreement with Iran than the narrow nuclear deal the administration quit in 2018?”

An earlier episode in which Iran blinked “may be instructive,” Satloff wrote. In 1988, an American warship accidentally shot down an Iranian airliner, killing 290. Fearing the U.S. was on the verge of fully supporting Iraq in its war with Iran, Ayatollah Ruhollah Khomeini agreed to a painful ceasefire.

Now, Iran needs the U.S. to lift its economic sanctions and pledge not to use military force or threaten the regime’s survival. To get this, “the price will be a broader agreement than the 2015 nuclear deal … to include verifiable restrictions on Iran’s missile program and its training, funding and arming of proxies, terrorist groups and Shiite militias,” Satloff wrote.

Neither the media nor Democrats are likely to hasten such a deal. They’ve adopted the narrative that Trump recklessly ordered the killing of Soleimani, risking a full-blown, bloody U.S.-Iran war. The New York Times reported that Pentagon officials were “flabbergasted” when Trump decided to take out Soleimani and has referred to his “approach to Iran” as “mercurial.”

But two events may have a more positive influence: 1) the missile attack on military bases without American deaths and 2) Iran’s decision not to turn over the task of attacking Americans in Iraq to proxies.

Retired Gen. Jack Keane, whose advice is taken seriously by Trump, has the best explanation of why there were no U.S. casualties. The retaliatory attacks on the two bases were designed, by the choice of particular missiles, to make casualties as unlikely as possible. The Iranians knew that casualties “would produce an overwhelming American response,” Keane told me.

And “they knew they were dealing with a different president,” Keane said. Killing one American had prompted a strong response. Had even a handful of soldiers died in the missile attacks on the two bases, the blowback ordered by Trump would likely have been far more furious and fatal.