A chiefly US-led nuclear deal between world powers and Iran has been held up as a harbinger to re-establishing formal relations but historical enmity makes broader detente a difficult prospect.

Both nations have reasons for distrust and a legacy of differences live on in the chants of “Death to America” that ring out at public ceremonies, even parliament, in the Iranian capital.

For the United States, the 444-day hostage crisis that followed the storming of its embassy in Tehran by revolutionary students in 1979 remains the defining moment.

The event shattered the presidency of Jimmy Carter and images of diplomats wearing black blindfolds still exemplify its harrowing place in the US public consciousness.

In modern-day Iran, however, the embassy building remains known as the “Den of Spies” given its role as a staging post for past CIA activities in collusion with the country’s former shah.

Shah Mohammad-Reza Pahlavi was installed on the throne in 1953 in a US-British coup that toppled Mohammad Mossadeq, a democratically-elected prime minister who had nationalized Iran’s oil industry, saying contracts were hugely biased against Tehran.

But it was the return of Iran’s long-exiled religious leader Ayatollah Ruhollah Khomeini that precipitated a full break in ties with Washington.

Khomeini’s founding of a revolutionary state gave birth to the “Death to America” slogan and it was he, as the Islamic republic’s first supreme leader, who dubbed the US “the Great Satan.”

The derogatory moniker was recently described as “remarkable” by present supreme leader Ayatollah Ali Khamenei, who had the final word for Iran on the nuclear deal in Vienna, only weeks after having said the US could not be trusted in the talks.

Iranians wave the national flag during celebrations in northern Tehran on July 14, 2015, after Iran's nuclear negotiating team struck a deal with world powers in Vienna (AFP/ATTA KENARE)

Iranians wave the national flag during celebrations in northern Tehran on July 14, 2015, after Iran’s nuclear negotiating team struck a deal with world powers in Vienna (AFP/ATTA KENARE)

Common interests or coincidence?

Giant anti-US slogans cover the walls of Tehran buildings and “Death to America” is heard every Friday at prayers in the mosques — a stance incompatible with better ties in the minds of many Americans.

Despite their deep mutual suspicion, the two countries currently have a common interest in defeating Islamic State jihadists who have ravaged Iraq and Syria in the past year.

Iran’s Foreign Minister Mohammad Javad Zarif spoke of the prospect of greater cooperation against IS after the nuclear deal sealed in Vienna on Tuesday.

And despite Khamenei’s public antipathy, it was he who approved secret talks with the US in 2012 that would eventually lead to the open diplomacy that resulted in the nuclear deal.

He has since said repeatedly that Iran’s interests differ from America’s in the Middle East, in particular over Tehran’s backing of Syrian President Bashar Assad.

Saudi army artillery fire shells towards Yemen from a post close to the Saudi-Yemeni border, in southwestern Saudi Arabia, on April 13, 2015. (photo credit: AFP / FAYEZ NURELDINE)

Saudi army artillery fire shells towards Yemen from a post close to the Saudi-Yemeni border, in southwestern Saudi Arabia, on April 13, 2015. (photo credit: AFP / FAYEZ NURELDINE)

US support for the Saudi-led Arab bombing campaign against Shiite Houthi rebels in Yemen has further widened the regional policy divide.

But other Iranian officials, notably President Hassan Rouhani, have said the nuclear deal can lead to wider cooperation and the government has said there is no bar to US firms investing in Iran.

In strife-torn Iraq, Ammar al-Hakim, who leads the Supreme Iraqi Islamic Council (SIIC), a powerful Shiite militia, said a nuclear deal would result in “key effects in all regional events.”

And long before the Vienna accord, the Islamic republic has proved itself to be pragmatic when it comes to its national interests.

It held joint discussions with Washington on the fight against the Taliban in Afghanistan in autumn 2001.

But any prospect of significant cooperation was extinguished months later when then US president George W. Bush dubbed Iran part of an “axis of evil, arming to threaten the peace of the world.”

Somehow, olive branches have since appeared.

Secret talks in 2012

In 2009, then US under secretary of state William Burns met with his counterpart Saeed Jalili on the sidelines of nuclear talks in Geneva, in a first such encounter since 1979.

And secret talks approved by Khamenei in Oman in 2012 led to the official dialogue and final nuclear deal with the P5+1 group of Britain. China, France, Russia and the United States plus Germany.

“Relations with the US have changed and for the first time since 1979 there is a different atmosphere,” a reform-minded analyst in Tehran said, describing the nuclear deal as “a game of dominoes.”

“It will create further opportunities for cooperation, including in the fight against IS in Iraq where US air strikes have complemented Shiite militias on the ground,” he said on condition of anonymity.

From left to right, Chinese Foreign Minister Wang Yi, French Foreign Minister Laurent Fabius, German Foreign Minister Frank Walter Steinmeier, European Union High Representative for Foreign Affairs and Security Policy Federica Mogherini, Iranian Foreign Minister Mohammad Javad Zarif, Head of the Iranian Atomic Energy Organization Ali Akbar Salehi, Russian Foreign Minister Sergey Lavrov, British Foreign Secretary Philip Hammon, U.S. Secretary of State John Kerry and US Secretary of Energy Ernest Moniz pose for a group picture at the United Nations building in Vienna, Austria, Tuesday, July 14, 2015. (Carlos Barria, Pool Photo via AP)

From left to right, Chinese Foreign Minister Wang Yi, French Foreign Minister Laurent Fabius, German Foreign Minister Frank Walter Steinmeier, European Union High Representative for Foreign Affairs and Security Policy Federica Mogherini, Iranian Foreign Minister Mohammad Javad Zarif, Head of the Iranian Atomic Energy Organization Ali Akbar Salehi, Russian Foreign Minister Sergey Lavrov, British Foreign Secretary Philip Hammon, U.S. Secretary of State John Kerry and US Secretary of Energy Ernest Moniz pose for a group picture at the United Nations building in Vienna, Austria, Tuesday, July 14, 2015. (Carlos Barria, Pool Photo via AP)

The United States has denied any “interaction” with Iranian-backed militias in Iraq, while Tehran has often said Washington’s effort is halfhearted and came too late.

But even when there appears to be scope for mutual benefit, tensions resurface.

As recently as last month the US said it still considered Iran a “state sponsor of terrorism,” citing Iran’s involvement in other regional countries.

And Iran is considered along with Syria, Lebanon’s Shiite party Hezbollah and the Palestinian Hamas movement, as the “axis of resistance” against Israel, which Tehran does not recognize.