US Secretary of State Rex Tillerson's sacking shows that Washington is set on quitting the nuclear deal between Tehran and world powers, Iran's deputy foreign minister said Wednesday.

"The United States is determined to leave the nuclear deal, and changes at the State Department were made with that goal in mind -- or at least it was one of the reasons," Abbas Araghchi said in comments carried by state new agency ISNA.

US President Donald Trump announced Tillerson's departure in a tweet on Tuesday, saying he would be replaced by Central Intelligence Agency chief Mike Pompeo, who takes a much harder line on Iran than his predecessor.

Trump has repeatedly slammed the 2015 nuclear deal, under which Iran agreed to freeze its nuclear programme in return for the lifting of crippling international sanctions.

Despite Tillerson's determination to stick with the deal, Trump has threatened to scrap what he has dubbed a "terrible" agreement unless tough new restrictions were placed on Iran by May 12.

A US exit could kill the pact between Iran, Germany and the five permanent members of the United Nations Security Council.

The deal's backers have presented it as a victory for diplomacy and nuclear non-proliferation efforts.

Tehran has repeatedly ruled out changing a single comma of the text.

The UN's nuclear energy agency, the IAEA, confirmed in February that Tehran had met its obligations under the agreement.

"If the US quits the nuclear deal, we will also quit it," Araghchi said Wednesday. "We have told the Europeans that if they can't keep the US in the deal, Iran will also leave it."

His comments contrast with those of Iranian officials including President Hassan Rouhani, who has said Iran will stick with the agreement as long as it is beneficial for the country -- even if the United States leaves.

While Iran has reaped massive economic benefits from the accord, notably by being able to resume oil exports, it is still constrained by US sanctions in other areas.