As the Washington and Tehran engage fitfully in what may be the last best chance at negotiations before a war to halt Tehran’s nuclear program, it is useful to remember that America has already fought one war with the Islamic Republic of Iran. In the 1980s President Ronald Reagan intervened in the Iran-Iraq war on the side of Baghdad and Saddam Hussein to tilt the conflict to an Iraqi victory. By 1987 America was engaged in a bloody naval and air war against Iran, undeclared of course, while Iraq fought a brutal land war. The lessons of our first war with Iran should be carefully considered before we embark hastily on a second.

The Iran-Iraq War was devastating—the largest and longest conventional interstate war since the Korean conflict ended in 1953. A half-million lives were lost, perhaps another million were injured and the economic cost was over a trillion dollars. One index of the scale of the tragedy is that the battle lines at the end of the war were almost exactly where they were at the beginning of hostilities. It was also the only war in modern times in which chemical weapons were used on a massive scale. Iraq gassed the Iranian army repeatedly and then turned the weapons on its own Kurdish population. No comparable use of weapons of mass destruction had occurred since 1918.

The 1980-1988 war led, in addition, to other disasters: the Iraqi invasion of Kuwait in 1990, the liberation of Kuwait a year later and the U.S. invasion of Iraq in 2003. The bloody U.S. war just ended in Iraq last year by President Obama was the finale in this march of folly. The seeds of multigenerational tragedy were planted in the Iran-Iraq war. We will live with its consequences for decades, perhaps longer.

The first lesson of Reagan’s war is: Expect to be blamed for all that goes bad. Both Iraqis and Iranians came to believe the U.S. was manipulating them during the war. Ironically (and perhaps naively) the U.S. tried to reach out to both belligerents during the course of the conflict—in great secrecy both times—to try to build a strategic partnership. The disastrous arms for hostages-policy, which came to be known as Iran-Contra, convinced Iraqis rightly that the U.S. was trying to play both sides of the conflict. The result was that when the war ended, the Iraqi regime and most Iraqis regarded the U.S. as a threat, despite Washington’s support during the hostilities: critical intelligence support to Baghdad; considerable diplomatic cover; and ignoring the largesse of our Arab allies, who loaned tens of billions of dollars to Baghdad to sustain Iraq’s war effort.

Iranians call the battle the “imposed war” because they believe the U.S. inflicted it upon them and orchestrated the global “tilt” toward Iraq during the fighting. They note that the United Nations did not condemn Iraq for starting the war—in fact, it did not even discuss the war for weeks after it started, and it eventually blamed Iraq as the aggressor only years later as part of a deal to free U.S. hostages held by pro-Iranian terrorists in Lebanon. The UN never sanctioned Iraq for the use of chemical weapons.

Though the war had tragic consequences for Iranians, they nevertheless consolidated their revolution by successfully portraying the war as a David and Goliath struggle, started by the U.S. and its allies. The country was mobilized to defend the revolution. The opposition was discredited, especially the Mujahedin e Khalq, which supported Saddam and Iraq. The Islamic revolution of 1979 was fairly short in duration and its cost minuscule in comparison to the Iran-Iraq war. For the generation of Iranians who are now leading their country, men like President Mahmoud Ahmadinejad and Supreme Leader Ali Khamenei, the war was the defining event of their lives and it has shaped their worldview. Their anti-Americanism and deep suspicion of the West generally can be traced directly to their understanding of the Iran-Iraq War. So expect another conflict to make Iran more extreme and more determined to get the bomb while it rallies Iranians behind the mullahs.

Another lesson of the first war is that Iran will not be easily intimidated by America. Iran by 1987 was devastated by the fighting; many of its cities like Abadan had been destroyed, its oil exports were minimal and its economy shattered. But it did not hesitate to fight the U.S. Navy in the Gulf and to use asymmetric means including terrorism to retaliate in Lebanon and elsewhere. Even when our navy had sunk most of theirs, Iran kept fighting, and the Iranian people rallied behind Ayatollah Khomeini.

Iran fought smartly, avoiding escalating matters too rapidly and too dangerously. As the U.S. Chairman of the Joint Chiefs, Major General Dempsey, and his Israeli counterpart, Lieutenant General Benny Gantz, have noted, Iranian behavior is rational, not suicidal. Iranian leaders will not take steps that endanger the revolution’s survival; they will look for our vulnerabilities in Afghanistan and Bahrain, Israel’s in Lebanon and the Saudis’ in Yemen to exploit.

A third key lesson is that ending the war will be a challenge. In 1988, Iran sued for a cease-fire only after catastrophic defeat on the ground by Iraq and when Saddam was threatening to fire chemical warheads into Iranian cities. Iranians believe they faced a second “Hiroshima” if they did not accept a truce. Many evacuated Tehran in fear of Iraqi chemical attack. For Khomeini it was drinking poison to accept a truce. No two wars are identical, but we should not expect Iran to back down easily if history is a guide. A few air strikes will not be the end of it.

Finally, be careful to weigh your ally’s advice. Ironically in the 1980s the closest U.S. partner in the region, Israel, pressed Washington hard and repeatedly to, in effect, switch sides and offer assistance to Iran. Israeli leaders, generals and spies were obsessed by the Iraqi threat in the 1980s, just as they are preoccupied by the Iranian threat today. They longed to restore the cozy relationship they had with the Shah in the 1960s and 1970s. Israel was the only consistent source of spare parts for the Iranian air force’s U.S.-built built jets throughout the war. Israeli leaders, notably Yitzhak Rabin and Shimon Peres, brought considerable pressure to bear on Washington for an American engagement with Tehran. Iran-Contra was in many ways their idea. American diplomats and spies abroad were told to turn a blind eye to Israeli arms deals with Tehran even when it was official U.S. policy to (in the Washington euphemism of the day) “staunch” all avenues by which the Iranians might obtain weapons or other material needed for their war effort.

Many Israeli security professionals quietly told their American counterparts in the 1980s that they thought Peres’ dream of rebuilding the alliance with Iran was crazy and foolish. They whispered to American intelligence officers that it would end in disaster. They were right.

Today many former Israeli intelligence officers are warning America not to listen the Prime Minister Benjamin Netanyahu and to avoid a military clash with Iran. Yuval Diskin, the retired head of the Shabak, the Israeli internal security service, has said Bibi is guided by “messianic feelings” which impair his judgement. Meir Dagan, his counterpart at the Mossad, the external security service, has said a military attack on Iran would be “stupid.” This time the warnings from our professional Israeli allies are not quiet.

Our Arab allies in the 1980s gave equally awful advice to the Reagan team. Saudi King Fahd assured a succession of visitors to the royal palaces in Riyadh and Jidda that Saddam was a changed man, a new moderate who could be trusted to act responsibly even if he was a tad violent. The Saudis, Kuwaitis and Emiratis gave Saddam billions of loans to fight the war. They pressed Washington to take strong action against Iran, to “kill the head of the snake.” It all sounds very familiar today.

Even King Hussein of Jordan, one of the wisest leaders of his generation in the world was enamored of Saddam. He traveled often to Baghdad to see Saddam and the road link from Aqaba to Baghdad was the critical logistical supply line to keep Iraq in the war. Jordanian “volunteers” fought with Iraq. The King urged Reagan to help Iraq and brokered the first CIA visit to Baghdad with critical intelligence for Saddam’s generals.

Many Americans have forgotten the lessons of our undeclared war in the 1980s. We have fought so many other wars since, in Iraq (twice), Afghanistan and Libya it is easy to forget. No Iranian has forgotten. As part of any serious political debate on whether to go to war again with Iran, President Obama and others would be wise to study the past.