The International Court of Justice (ICJ) on Wednesday approved a bid by the Iranian government to recover some $2 billion (€1.77bn) in frozen assets in the US.

The US had sought for the bid to be thrown out, saying Iran had "unclean hands". Washington has long considered Iran a state sponsor of terrorism.

The ICJ decision, which came after two-and-a-half years of proceedings, knocked back US objections and paved the way for Iran to proceed with attempts to recover its assets.

Tehran argued that keeping the assets frozen was illegal because it breached the Treaty of Amity – a friendship treaty signed between the two countries in 1955.

The treaty guaranteed the protection of both countries’ property. It also barred "restrictions on the making of payments, remittances, and other transfers of funds."

But US defense attorneys argued that the Treaty had been designed to govern during "normal and ongoing commercial and consular relations… a state of affairs that has no existed for nearly four decades."

Iran took the US to court in 2016, almost two years before Washington said it was terminating the Treaty.

Read more: US terminates 1955 'Treaty of Amity' with Iran

Much of the money already spent

The money, likely the largest seizure of Iranian property since the 1979 Islamic Revolution, was reportedlysecretly frozen in US Citibank bank accounts in 2008.

According to the latest Treasury report, only 23% of the original amount remains. A large chunk was redistributed after the US Supreme Court ruled the assets would compensate some 1,000 family members — victims of terrorist violence they alleged had been orchestrated by Tehran.

Read more: US Supreme Court: Iran bank must pay attack victims

Iran has disputed this ruling and asked for the UN to intervene.

ICJ 'lacks jurisdiction,' according to US

Iran also used the Treaty of Amity to take the US to court last year, over renewed sanctions on the Islamic Republic imposed by Donald Trump's administration last May.

The ICJ ordered the US lift its sanctions on humanitarian goods to Iran, but Washington dismissed that ruling saying the court had no jurisdiction.

A day later, US Secretary of State Mike Pompeo announced the treaty would be terminated.

"This is a decision, frankly, that is 39 years overdue," he said. "Iran is abusing the ICJ for political and propaganda purposes."

The ICJ is the top court of the United Nations. It settles legal disputes between countries in accordance with international law, but lacks power to enforce its decisions.