Media playback is unsupported on your device Media caption Iranian Americans on Trump's policies

US President Donald Trump and Iranian President Hassan Rouhani have traded hostile warnings, amid rising tensions between the two countries.

Mr Trump tweeted Iran would "suffer consequences the likes of which few throughout history have ever suffered before" if it threatened the US.

Mr Rouhani earlier said that war with Iran would be "the mother of all wars".

In May, the US left a deal which curbed Iran's nuclear activities in return for the lifting of international sanctions.

Washington is now re-imposing the sanctions, despite objections from the UK, France, China, Russia and Germany, who all signed the 2015 agreement.

But there are other flashpoints too. The US is deeply suspicious of Iranian activity in the Middle East and is an ally of Israel and Saudi Arabia, two of Iran's foes.

Skip Twitter post by @realDonaldTrump To Iranian President Rouhani: NEVER, EVER THREATEN THE UNITED STATES AGAIN OR YOU WILL SUFFER CONSEQUENCES THE LIKES OF WHICH FEW THROUGHOUT HISTORY HAVE EVER SUFFERED BEFORE. WE ARE NO LONGER A COUNTRY THAT WILL STAND FOR YOUR DEMENTED WORDS OF VIOLENCE & DEATH. BE CAUTIOUS! — Donald J. Trump (@realDonaldTrump) July 23, 2018 Report

President Rouhani's comments, made to Iranian diplomats, did leave open the possibility of future good relations with the US.

"America should know that peace with Iran is the mother of all peace, and war with Iran is the mother of all wars," he said, according to Iran's state news agency Irna.

Responding to Mr Trump's broadside, Iranian Foreign Minister Javad Zarif tweeted: "Color us unimpressed."

Skip Twitter post by @JZarif COLOR US UNIMPRESSED: The world heard even harsher bluster a few months ago. And Iranians have heard them —albeit more civilized ones—for 40 yrs. We’ve been around for millennia & seen fall of empires, incl our own, which lasted more than the life of some countries. BE CAUTIOUS! — Javad Zarif (@JZarif) July 23, 2018 Report

Mr Trump's angry rhetoric has echoes of his Twitter barrages against North Korea's Kim Jong-un, whom he branded a "madman". Their verbal hostilities nonetheless evolved into diplomacy.

On Monday, a senior commander in Iran's Revolutionary Guards suggested the US president's statements were part of a broader strategy.

"The remarks Trump makes against Iran are psychological warfare and he would be mistaken should he seek to take action against Iran," Gholamhossein Gheybparvar said, quoted by the Iranian Students News Agency.

On Sunday, US Secretary of State Mike Pompeo said he wanted to try to stop countries importing Iranian oil by November as part of continued pressure on Tehran.

Addressing a group of Iranian Americans in California, he said the Iranian regime "resembles the mafia more than a government".

The gathering was the first time a top US official had directly addressed such a large number of Iranian Americans, and is seen as part of the administration's strategy to increase pressure on Iran's leadership.

What do the US and Iran disagree on?

Mr Trump has consistently opposed the 2015 nuclear deal, which saw the US release billions of dollars of frozen assets in exchange for curbs on Iran's nuclear programme

The Trump administration regards Iran as a destabilising force in the Middle East, arguing the nuclear deal enabled Iran to pursue a more assertive regional policy. Iran has sent hundreds of troops and thousands of volunteer militiamen to Syria, and has strengthened its military presence there

Gulf states have accused Iran of backing Yemen's Houthi rebels with both money and weapons, though Iran has denied this. Saudi Arabia, a key US ally, is a major adversary of Iran and has repeatedly warned about Iran's intentions

Why did the US withdraw from the nuclear deal?

In May, Mr Trump called the nuclear accord - or Joint Comprehensive Plan of Action (JCPOA) as it is formally known - a "horrible, one-sided deal that should have never, ever been made".

He alleged that the deal did not restrict Iran's "destabilising activities" in the region enough, and could not detect or prevent any breaking of its terms.

Analysts also cited the influence of White House Iran hawks including Mr Pompeo and US National Security Adviser John Bolton, and Mr Trump's tendency to target major policies of his predecessor President Obama.

Media playback is unsupported on your device Media caption People in the Iran-aligned suburbs of Beirut give their reaction to US withdrawal from the nuclear deal

Iran insists its nuclear programme is entirely peaceful, and its compliance with the deal has been verified by the International Atomic Energy Agency (IAEA), which has said Iran is honouring its commitments.

The IAEA has said its inspectors were granted access to all locations they needed to visit in 2017, but that they did not seek to enter any military sites, which Iranian officials declared off-limits - a move the US said raised doubts over Tehran's compliance.

In May, Mr Pompeo outlined 12 conditions for any "new deal" between the US and Iran, including the withdrawal of its forces from Syria and an end to its support for rebels in Yemen.

Iran is one of the world's largest oil producers, with exports worth billions of dollars each year. It is already feeling economic pressures, and has seen large-scale protests over rising prices and a decline in the value of its currency, the rial.