The UN’s international court of justice has reprimanded the US over its re-imposition of sanctions on Iran, ordering Washington to lift restrictive measures linked to humanitarian trade, food, medicine and civil aviation.

The Hague ruling, delivered on Wednesday, is a victory for Iran after it complained to the ICJ in July that the return to sanctions imposed by Donald Trump following the US withdrawal from the 2015 landmark nuclear agreement was in violation of the Treaty of Amity, a 1955 pre-revolutionary friendship treaty.

The US secretary of state, Mike Pompeo, reacted by announcing the US was terminating the treaty, which the US signed with Tehran two years after orchestrating a coup to topple the elected prime minister, Mohammad Mosaddegh.

“This is a decision that is frankly 39 years overdue,” Pompeo told reporters. Legally it will take a year for US withdrawal to take effect, but the secretary of state, indicated that the administration did not take it seriously, claiming that Iran had been “ignoring it for an awfully long time”. He said the ICJ case had served the purpose of underlining the “absolute absurdity” of the treaty.

Pompeo insisted that there were appropriate exemptions in US sanctions for humanitarian transactions and aviation safety. He described the case that Iran had taken to the ICJ as “meritless”, and made clear that the US would ignore the court’s ruling. “I am disappointed the court failed to recognise its lack of jurisdiction,” said Pompeo.

The Tehran government “has attempted to interfere with the sovereign rights of the United States to take a lawful action necessary to protect our national security,” he said. “And Iran is abusing the ICJ for political and propaganda purposes.”

In bringing the case to the ICJ, Iran also argued that the US had violated the terms of the nuclear accord, endorsed by a UN security council resolution, by unilaterally pulling itself out of that agreement. The International Atomic Energy Agency (IAEA) has verified 12 times that Iran has abided by the terms of that agreement.

Iran’s lawyers said at the court hearing in August that the US sanctions were blanket measures that had strangled the Iranian economy, affecting ordinary citizens in all aspects of their lives. Wednesday’s ruling, classified as a “provisional measure” before a final verdict that could take years to be issued, was given unanimously. It is binding and cannot be appealed but the ICJ has no means of enforcing it. Washington has argued that the issue is a matter of national security for the US.

It is too early to assess what the ruling’s impact will be in practical terms, given the EU’s backing for the nuclear accord. But the ruling puts on the record that the reimposition of sanctions is viewed as illegal by the international community.

Reacing to the ICJ ruling, the US ambassador to the Netherlands, Pete Hoekstra, said in a statement that “this is a meritless case over which the court has no jurisdiction”.

“The court considers that the United States, in accordance with its obligations under the 1955 treaty, must remove, by means of its choosing, any impediments arising from the measures” relating to humanitarian needs, medicines, foodstuff and agricultural commodities and civil aviation, the ruling said.

“To this end, the United States must ensure that licences and necessary authorisations are granted and that payments and other transfers of funds are not subject to any restriction in so far as they relate to the goods and services referred to above.”

The court ordered both parties to refrain from any action that might aggravate or extend the dispute.

Iran’s foreign minister, Mohammad Javad Zarif, tweeted after the court’s ruling:

UN top court rules that US must comply with obligations violated by re-imposing sanctions on Iranian people when exiting #JCPOA. Another failure for sanctions-addicted USG and victory for rule of law. Imperative for int’l community to collectively counter malign US unilateralism. pic.twitter.com/8AMGL0tqXU — Javad Zarif (@JZarif) October 3, 2018

Ahead of the ruling, Zarif had said in a BBC interview that the US was driven by a policy of regime change and listened to the wrong people, which he said was leading Washington to make mistakes and have “delusional views” of the situation in Iran.

“The economic warfare that the United States and some of its regional clients are conducting against Iran is psychological warfare more than real economic warfare,” the Iranian foreign minister said.

Unlike the US, other parties to the nuclear deal including the EU, China and Russia have remained adamant that they want to keep the deal. Trump’s first set of sanctions was re-imposed in August. Those measures affected Iran’s access to dollars, gold and precious metals and the car-making sector, and sparked street protests.

They are to be followed by a set of additional and more stringent measures on 4 November, including an embargo on the imports of Iranian oil and sanctions on its banking sector.

The EU, Iran, China and Russia have set out a plan to sidestep these. European diplomats hope the proposed plan, known as a special purpose vehicle (SPV), will help persuade an increasingly reluctant Iran to stay inside the deal in the hope of rescuing its economy.

Asked about this, Zarif said: “Prime minister May as well as President Macron and everybody else said that we are committed to see that Iran enjoys the economic dividends of the deal and the Europeans probably made better commitments than anybody expected. Then it was to translate those political commitment[s] into mechanisms and I believe those mechanisms are going to be in place.”

He said the next step, which is “the most difficult and important”, is to see whether those mechanisms work. “We are going to be a little bit more patient but it doesn’t mean that our patience will never run out,” he said.

Asked about Trump’s offer to hold a summit with his Iranian counterpart, Hassan Rouhani, Zarif did not rule out a possibility.

“Nothing is impossible. The outcome … would be a photo opportunity and a two-page document,” he said, referring the document signed in the summer by Trump and North Korea’s Kim Jong-un. “We have a 150-page document, which is the deal, which was negotiated word by word not only by Iran and the United States, but by six other powers. Having negotiated that deal and having been involved in this process for a very long time, I can assure President Trump that the US will not get a better deal.”