US President Donald Trump has issued a stern warning to Iran, suggesting it will be destroyed if a conflict breaks out between the two countries.
"If Iran wants to fight, that will be the official end of Iran," he said in a tweet on Sunday. "Never threaten the United States again!"
Iranian Foreign Minister Mohammad Javad Zarif tweeted in response that such "genocidal taunts won't 'end Iran'".
The US has deployed additional warships and planes to the Gulf in recent days.
But Mr Trump's tweet marks a shift in tone after recent attempts to downplay the possibility of military conflict.
In an interview with Fox News broadcast on Sunday, the president vowed that he would not let Iran develop nuclear weapons but said he did not want a conflict.
"I'm not somebody that wants to go into war, because war hurts economies, war kills people most importantly - by far most importantly," he said.
Iran has also moved to talk down concerns over the escalating tensions. On Saturday, its foreign minister insisted there was no appetite for war.
"There will not be a war since neither we want a war nor does anyone have the illusion they can confront Iran in the region," Mr Zarif told state news agency Irna.
On Monday he dismissed Mr Trump's tweet, saying the president "hopes to achieve what Alexander [the Great], Genghis [Khan] & other aggressors failed to do."
"Iranians have stood tall for millennia while aggressors all gone. #EconomicTerrorism & genocidal taunts won't 'end Iran'," he added. "#NeverThreatenAnIranian. Try respect—it works!"
President Trump, after appearing to dial down the tensions with Iran, has now seemingly threatened catastrophic consequences if there is any attack against US interests or facilities.
It underscores the mercurial approach of the US president to world affairs - restraint one moment and bluster the next.
Such an approach is hugely destabilising and could contribute to Tehran misjudging US intentions.
All of the ingredients for a confrontation are there: a lack of clarity in the US approach; the potential desire by Iran to push matters to the brink; and a series of incidents in the region itself (the recent sabotage against a small number of oil tankers and the rocket attack near the US compound in Baghdad) which demonstrate that there are elements on the ground eager to inflame tensions and test the US administration's resolve.
Why are there tensions?
The latest frictions come after Iran suspended its commitments under the 2015 international nuclear deal, and threatened to resume production of enriched uranium which is used to make reactor fuel and nuclear weapons.
The deal aimed to cut sanctions on Iran in exchange for an end to its nuclear programme, but the US unilaterally withdrew from the agreement last year.
Calling the deal "defective", Mr Trump then re-imposed sanctions.
Tehran has allegedly placed missiles on boats in the Gulf, and US investigators reportedly believe the country damaged four tankers off the coast of the United Arab Emirates, claims Iran has denied.
What's the latest in the Gulf?
On Sunday, the Iraqi military said a rocket had been fired into Baghdad's heavily-fortified Green Zone, which houses government buildings and foreign embassies.
It reportedly hit an abandoned building near to the US embassy. There were no casualties and it is not yet clear who was behind the attack.
A State Department spokesman however said the US will hold Iran responsible "if any such attacks are conducted by its proxy militia forces".
Mr Trump's threats on Twitter came hours after the first reports of the rocket attack.
In recent days, the US has deployed the USS Abraham Lincoln aircraft carrier to the region and reportedly drawn up plans to send 120,000 troops to the Middle East.
Diplomatic staff have been ordered to leave Iraq, and the US military have raised the threat level in the region because of alleged intelligence about Iran-backed forces - contradicting a British general who had said there was "no increased threat".
Dutch and German soldiers said they had suspended their military training programmes in the country.
Separately, Saudi Arabia accused Tehran of a drone attack on a pipeline on Friday. It alleged that Houthi rebels in Yemen conducted the strike on Iran's orders.
A state-aligned Saudi newspaper called for the US to launch attacks on the country.
Iran denies the allegations.