The Hague (AFP) - The UN's top court ordered the United States on Wednesday to lift sanctions on humanitarian goods for Iran in a stunning rebuke to US President Donald Trump.

Tehran hailed its "victory" after the International Court of Justice ruled that sanctions reimposed after Trump pulled out of a nuclear deal put Iranian lives at risk.

The US said the case was "meritless" and only involved a few sanctions, although the decision is still likely to rile Trump.

It remains unclear whether the judgment will be anything more than symbolic because both Washington and Tehran have ignored ICJ decisions in the past.

The judges at the court in The Hague ruled unanimously that the sanctions on some goods breached a 1955 "Treaty of Amity" between Iran and the US that predates Iran's Islamic Revolution.

They said Washington "shall remove by means of its choosing any impediments arising from the measures announced on 8 May to the free exportation to Iran of medicines and medical devices, food and agricultural commodities" as well as airplane parts and services, chief judge Abdulqawi Ahmed Yusuf said.

The court said sanctions on goods "required for humanitarian needs... may have a serious detrimental impact on the health and lives of individuals on the territory of Iran."

US sanctions also had the "potential to endanger civil aviation safety in Iran."

Trump slapped a first round of sanctions on Iran in August after pulling out in May from the 2015 international deal aimed at curbing Tehran's nuclear ambitions, to the dismay of his European allies. A second round of punitive measures is due in November.

- 'Meritless case' -

Iran dragged the US to the ICJ in July, and during four days of hearings in late August, its lawyers accused Washington of "strangling" its economy.

Foreign drugs are now a rare commodity in Iran which is also dealing with a free-falling rial local currency and price hikes. Official Iranian statements acknowledge the shortage and say imports of certain drugs are no longer subsidised.

Story continues

Iranian Foreign Minister Mohammad Javad Zarif called the court ruling "another failure for sanctions-addicted US government and victory for rule of law".

The foreign ministry said in a statement that the ruling was a "clear sign" that "Iran is in the right".

Washington however says the case is outside the court's purview as it concerns a matter of national security.

"This is a meritless case over which the court has no jurisdiction," US ambassador to the Netherlands Pete Hoekstra tweeted.

But Hoekstra pointed out that the tribunal "declined to grant the sweeping measures requested by Iran" and it was "a narrow decision on a very limited range of sectors."

Wednesday's ruling is in fact a decision on so-called provisional measures ahead of a final decision on the matter, which may take several more years, experts said.

Decisions by the Hague-based ICJ, which rules on disputes between United Nations members, are binding but it has no mechanism through which it can enforce its decisions.

- Iran, US ignored rulings -

In 1986 Washington disregarded the court’s finding that it had violated international law by supporting the pro-US Contra rebels in Nicaragua.

Iran in turn ignored the ICJ’s ruling in 1980 to release hostages taken during the Iran hostage crisis.

Trump has previously shown his disdain for overarching international organisations that limit US sovereignty, including the UN.

He recently heavily criticised the separate International Criminal Court in The Hague over a probe into alleged US abuses in Afghanistan.

Trump has also ridden roughshod over his allies, alarming allies with his decision to pull out of the 2015 nuclear deal that saw Iran agree to limit its nuclear programme and let in international inspectors in return for an end to years of sanctions by the West.

Trump argues that funds from the lifting of sanctions under the pact have been used to support terrorism and build nuclear-capable missiles.

European allies have pledged to keep the deal alive, with plans for a mechanism to let firms skirt the US sanctions as they do business with Iran.

US-Iran relations have plunged to a new low since Trump's election in 2016 Trump and Iranian President Hassan Rouhani facing off at the UN in September.

Despite their 1955 Treaty of Amity and Economic Relations, Iran and the United States have not had diplomatic ties since 1980.

Hearings in a separate Iranian case against the US freezing of around $2 billion of Iranian assets to help American terror victims is due to start at the ICJ next week.