The International Court of Justice on Thursday rejected Iran's bid to unblock nearly $2 billion in central bank assets frozen by the United States, but ruled Washington had illegally seized some other funds.
Judges at the UN's top court said Washington had "violated" the rights of several Iranian individuals and companies and must compensate them, yet ruled they had no jurisdiction over the bank case, which involved a much larger amount.
The arch-foes both claimed the ICJ verdict as a win. Tehran said the decision underlined the "illegal behaviour" of the United States, as Washington hailed it as a "major victory".
Iran dragged the United States to the Hague in 2016 after the US Supreme Court that year ruled the assets should be paid to victims of attacks blamed on Tehran, including the 1983 bombing of a US Marine barracks in Beirut.
"The court by ten votes to five upholds the objection to jurisdiction raised by the United States of America" on the central bank issue, ICJ judge Kirill Gevorgian said as he read out the 66-page ruling.
The contentious judgement comes amid tensions over recent US strikes on Iran-linked groups in Syria, plus Tehran's nuclear programme and its support for Russia's war in Ukraine.
Tehran, which denies responsibility for the terror attacks alleged by Washington, argued the freezing of funds breached the 1955 "Treaty of Amity" between the United States and Iran.
The deal was signed long before the 1979 Islamic revolution that overthrew the pro-US shah and severed ties with the United States.
Iran had called for the return of $1.75 billion belonging to Iran's Central Bank, or Bank Markazi, plus interest, along with assets belonging to Iranian nationals and companies.
The US Supreme Court had ruled that the funds should go to families and survivors of the 1983 Beirut bombing which killed 299 people including 241 US soldiers, the 1996 Khobar Towers bombing in Saudi Arabia which killed 19 people, and other attacks.
On the main issue, the ICJ ruled there was no case to answer on the matter of the Iranian central bank.
It said the bank did not count as a company, as Tehran had argued, and that only companies were protected under the decades-old treaty.
But ICJ judges said Washington had "violated its obligations" under the decades-old US-Iranian treaty, including that it had been "unreasonable" in recognising the legal status of some Iranian firms.
"Iran is entitled to compensation for the injury caused," the court said.
It gave the United States and Iran 24 months to agree on an amount for the payout - otherwise it would do so itself.
ICJ rulings are binding and cannot be appealed but have no enforcement powers.
"The verdict... shows once again the legitimacy" of Iran's positions "and the illegal behaviour of the United States," Tehran's foreign ministry said in a statement
Acting legal adviser Rich Visek of the US State Department said the court had "rejected the vast majority of Iran's case".
"This is a major victory for the United States and victims of Iran's state-sponsored terrorism," he said.
But State Department spokesman Vedant Patel said Washington was "disappointed" the court ruled that the United States violated the treaty.
"The treaty was never intended to shield Iran from having to compensate US victims of its sponsorship of terrorism," he said.
The United States formally withdrew from the Treaty of Amity in 2018 after the ICJ, in a separate case, ordered Washington to lift nuclear-related sanctions on humanitarian goods for Iran.
The frozen assets judgement comes against a backdrop of growing tensions.
Tehran recently condemned US air strikes on Iran-linked forces in Syria that reportedly killed 19 people, which Washington said it carried out following a deadly drone attack on US forces on Thursday.
Talks have meanwhile long been deadlocked on reviving a landmark 2015 multinational accord on Iran's nuclear activity that the US pulled out of in 2018.