The 1979 U.S. Embassy takeover in Tehran may have ended after 444 days, but both America and Iran still remain captive to a crisis that began 40 years ago.

While those held hostage at the embassy ultimately would be released, Iran to this day holds dual nationals and those with Western ties as bargaining chips for negotiating deals. Cries of "Death of America" still echo through hard-line rallies as Iran's supreme leader criticizes the untrustworthiness of the "Great Satan" over President Donald Trump unilaterally pulling the U.S. out of the 2015 nuclear deal.

That mutual suspicion has reached a level unseen since the hostage crisis — and perhaps in some ways has gone beyond it.

While President Jimmy Carter ultimately expelled all Iranian diplomats from the U.S. during the crisis, America kept issuing visas to Iranians. Today, the Trump administration's longstanding travel ban on Iran and other nations largely keeps Iranians from getting visas at all, despite large Iranian-American populations in cities like Los Angeles.

The ban has brought non-immigrant visa issuance for Iranians down from over 35,000 in 2015 to some 6,000 in 2018, according to State Department statistics. That has cut off families from each other, as well as shut down a crucial source of information about Iran that U.S. diplomats gather during visa interviews.

Meanwhile, the chance for an armed conflict has risen, something avoided even during the hostage crisis. The U.S. blames Iran for a series of attacks across the Middle East in the last six months, culminating with a drone-and-cruise-missile attack on Saudi Arabia in September that halved the kingdom's oil production and caused energy markets to spike. Iran denies being responsible for that attack, as well as for explosions that targeted oil tankers off the United Arab Emirates. However, Tehran proudly claimed shooting down a U.S. military surveillance drone in June and has seized other tankers.

How did the U.S. and Iran get here? A direct line can be drawn back to the American miscalculations before, during and after the Islamic Revolution.

"Iran is not in a revolutionary or even a 'pre-revolutionary' situation," a CIA analysis on the country circulated in the White House declared in August 1978. "There is dissatisfaction with the shah's tight control of the political process, but this does not at all at present threaten the government."

By January 1979, Shah Mohammad Reza Pahlavi would flee Iran while suffering from a fatal illness the U.S. knew nothing about. The Islamic Revolution would take hold in the next month, which also would see Marxist students overrun the embassy in Tehran and briefly hold it.

The U.S. in part realized the danger its diplomats, employees, military advisers and spies faced. The U.S. presence in Iran dropped from over 1,400 civilian and military personnel to about 70 by the time of the Nov. 4, 1979 embassy takeover.

However, the Carter administration sought to establish a relationship with Iran's revolutionary government. There had been billions of dollars in arms sales to the shah, including advanced F-14 Tomcat jet fighters that required American support. The U.S. also wanted to maintain access to its secret listening posts in Iran to monitor signals and missile tests in the Soviet Union. America long had seen the shah as a bulwark in the Persian Gulf against Soviet expansion. Soviet forces would invade Afghanistan amid the hostage crisis, leading to the Carter Doctrine — that the U.S. would use military force to defend its interests across the energy-rich region.

All this blinded Washington to warnings from Tehran. When Carter allowed the shah into New York for medical treatment Oct. 23, he lit the fuse for the Islamist student takeover. A protest Nov. 1 saw the embassy protected.

That wasn't the case Nov. 4, both the 15th anniversary of the shah expelling Ayatollah Ruhollah Khomeini from Iran and of a bloody attack by security forces on students the year before. Police faded into the background as hundreds of students jumped the fence and took over the embassy in 3 1/2 hours.

But the students themselves would date their anger back further to the 1953 coup that overthrew Iran's elected prime minister and cemented the shah's power, a putsch organized by the CIA and British spies.

The hostage crisis ultimately ended on the day President Ronald Reagan was inaugurated in 1981. It saw both sides agree to the Algiers Accords, which promised to end disputes over unfulfilled military purchases made by the shah, outstanding court cases and U.S. political and military intervention "in Iran's internal affairs."

Yet today, some payments from the shah's era remain outstanding as Iran continues to detain dual nationals. A U.N. panel has described "an emerging pattern involving the arbitrary deprivation of liberty of dual nationals" in Iran. In the case of detained Iranian-British national Nazanin Zaghari-Ratcliffe, some have tied her case to 400 million pounds ($530 million) held by the United Kingdom from a never-completed tank sale to the shah.

Meanwhile, Iran routinely accuses the U.S. of interfering in its internal affairs. It points now to the Trump administration's "maximum pressure" policy, which it describes as trying to topple its Shiite theocracy.

Iran has sought to challenge Trump's renewed U.S. sanctions after his pullout from the nuclear deal before the International Court of Justice at The Hague. But like with everything in this crisis, Iran's argument took root in the long history between the two countries — a 1955 friendship treaty signed between the U.S. and the shah that the Islamist students who took over the embassy opposed.

___

EDITOR'S NOTE — Jon Gambrell, the news director for the Gulf and Iran for The Associated Press, has reported from each of the Gulf Cooperation Council countries, Iran and other locations across the world since joining the AP in 2006. Follow him on Twitter at www.twitter.com/jongambrellAP .

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.