The last thing the United States needs is another war in the Middle East. Yet a drumbeat of provocative words, outright threats and actions — from President Trump and some of his top aides as well as Sunni Arab leaders and American activists — is raising tensions that could lead to armed conflict with Iran.

Tehran invites some of this hostility with moves like detaining Xiyue Wang, a Princeton scholar, and supporting the Syrian president, Bashar al-Assad. And for many American politicians, Iran — estranged from the United States since 1979 — deserves only punishment and isolation. But Iran and the United States also share some interests, like fighting the Islamic State. So why not take advantage of all the diplomatic tools, including opening a dialogue, used before to manage difficult and even hostile governments?

It is useful to recall the lead-up to the 2003 Iraq War, arguably America’s biggest strategic blunder in modern times. After the Sept. 11 attacks, the country was riveted on Al Qaeda and the Taliban in Afghanistan. But in Washington, the talk turned almost immediately to Iraq and the chance to overthrow Saddam Hussein, even though he had nothing to do with Sept. 11 and had no nuclear weapons, as President George W. Bush alleged. Mr. Bush decided to fight a pre-emptive war without a solid justification or strategy.

Such a stumble into war could happen again. Here are some reasons to be concerned:

■ President Trump campaigned on a pledge to tear up the 2015 seven-nation nuclear pact under which Iran rolled back its nuclear program in exchange for a lifting of sanctions. Although he twice certified to Congress, most recently on Monday, that Iran remains in compliance with the deal, he did so grudgingly and with the subsequent imposition of new sanctions related to Iran’s ballistic missile tests. The Iranians say Mr. Trump is in danger of violating the agreement, especially after urging European leaders not to do business with Iran. A central promise of the deal was that Tehran would benefit economically in exchange for its nuclear restraint. Instead of taking advantage of this diplomatic breakthrough, Mr. Trump seems intent on reversing it by provoking Iran to renege or reneging himself, in much the way he rejected the Paris climate accord.