President Donald Trump has accused Iran of "playing with fire" as part of a diplomatic spat over Iran's latest ballistic missile test.

Referring to the previous administration of Barack Obama, Mr Trump added that the Iranian government didn't appreciate how "kind" that the US had been to them - a potential reference to the nuclear deal struck with the US and other world powers in 2015 where Iran's nuclear capability was reduced in return for a loosening of sanctions. Mr Trump said that he would not follow a similar path.

Shortly after My Trump's tweet Iran's Foreign Minister Mohammad Javad Zarif said via the same platform that the his country is unmoved by US threats following its missile test launch and Tehran will never initiate war.

“Iran unmoved by threats as we derive security from our people. Will never initiate war, but we can only rely on our own means of defence,” Mr Zarif tweeted

The controversial orders Donald Trump has already issued Show all 9 1 /9 The controversial orders Donald Trump has already issued The controversial orders Donald Trump has already issued Trump and the media White House Press Secretary Sean Spicer takes questions during the daily press briefing Getty Images The controversial orders Donald Trump has already issued Trump and the Trans-Pacific Partnership Union leaders applaud US President Donald Trump for signing an executive order withdrawing the US from the Trans-Pacific Partnership negotiations during a meeting in the Roosevelt Room of the White House in Washington DC. Mr Trump issued a presidential memorandum in January announcing that the US would withdraw from the trade deal Getty The controversial orders Donald Trump has already issued Trump and the Mexico wall A US Border Patrol vehicle sits waiting for illegal immigrants at a fence opening near the US-Mexico border near McAllen, Texas. The number of incoming immigrants has surged ahead of the upcoming Presidential inauguration of Donald Trump, who has pledged to build a wall along the US-Mexico border. A signature campaign promise, Mr Trump outlined his intention to build a border wall on the US-Mexico border days after taking office Getty Images The controversial orders Donald Trump has already issued Trump and abortion US President Donald Trump signs an executive order as Chief of Staff Reince Priebus looks on in the Oval Office of the White House. Mr Trump reinstated a ban on American financial aide being granted to non-governmental organizations that provide abortion counseling, provide abortion referrals, or advocate for abortion access outside of the United States Getty Images The controversial orders Donald Trump has already issued Trump and the Dakota Access pipeline Opponents of the Keystone XL and Dakota Access pipelines hold a rally as they protest US President Donald Trump's executive orders advancing their construction, at Columbus Circle in New York. US President Donald Trump signed executive orders reviving the construction of two controversial oil pipelines, but said the projects would be subject to renegotiation Getty Images The controversial orders Donald Trump has already issued Trump and 'Obamacare' Nancy Pelosi who is the minority leader of the House of Representatives speaks beside House Democrats at an event to protect the Affordable Care Act in Los Angeles, California. US President Donald Trump's effort to make good on his campaign promise to repeal and replace the healthcare law failed when Republicans failed to get enough votes. Mr Trump has promised to revisit the matter Getty Images The controversial orders Donald Trump has already issued Donald Trump and 'sanctuary cities' US President Donald Trump signed an executive order in January threatening to pull funding for so-called "sanctuary cities" if they do not comply with federal immigration law AP The controversial orders Donald Trump has already issued Trump and the travel ban US President Donald Trump has attempted twice to restrict travel into the United States from several predominantly Muslim countries. The first attempt, in February, was met with swift opposition from protesters who flocked to airports around the country. That travel ban was later blocked by the Ninth Circuit Court of Appeals. The second ban was blocked by a federal judge a day before it was scheduled to be implemented in mid-March SANDY HUFFAKER/AFP/Getty Images The controversial orders Donald Trump has already issued Trump and climate change US President Donald Trump sought to dismantle several of his predecessor's actions on climate change in March. His order instructed the Environmental Protection Agency to reevaluate the Clean Power Plan, which would cap power plant emissions Shannon Stapleton/Reuters

The episode follows a tweet from President Trump a day previously that he had put Iran “on notice” over a the missile test that could be in contravention of a UN resolution. He added that Tehran in that should have been “thankful” for the nuclear deal as the country was on “its last legs”.

The warnings appear as an early manifestation of Mr Trump's promise of a tougher American approach to Iran, but the Thursday tweet received an angry response in Tehran - which may have prompted the latest outburst. Foreign Ministry spokesman Bahram Ghasemi was quoted by state TV as saying: “Instead of thanking Iran for its continued fight against terrorism ... the American government is practically helping the terrorists by claims about Iran that are baseless, repetitive and provocative.”

The missile test occurred at a well-known site outside Semnan, about 140 miles east of Tehran. The Khorramshahr medium-range ballistic missile flew 600 miles before exploding, in a failed test of a reentry vehicle, US officials said.

Iran said it had successfully test-fired the ballistic missile that the US said had exploded early, the semi-official Tasnim news agency reported.

“The missile test on Sunday was successful ... the test was not a violation of a nuclear deal with world powers or any UN resolution,” defence minister Hossein Dehghan told Tasnim.

A top adviser to Supreme Leader Ayatollah Ali Khamenei said Iran will not yield to US threats over a recent ballistic missile test that was aimed at limiting its defence capabilities.

“This is not the first time that an inexperienced person [US President Donald Trump] has threatened Iran ... the American government will understand that threatening Iran is useless,” Ali Akbar Velayati was quoted as saying by the semi-official Fars News Agency.

“Iran does not need permission from any country to defend itself.”

The warning from the US could foreshadow more aggressive economic and diplomatic measures against Iran.

Three senior US officials, speaking on condition of anonymity, told Reuters a range of options, including economic sanctions, were being considered and that a broad review was being conducted of the US posture toward Iran.

“We are in the process of evaluating the strategic options and the framework for how we want to approach these issues,” the official said. “We do not want to be premature or rash or take any action that would foreclose options or unnecessarily contribute to a negative response.

“Our sincere hope is that the Iranians will heed this notice today and will change their behaviour.”