Secretary of State Mike Pompeo announced Wednesday that the U.S. is terminating a 1955 treaty with Iran, after the United Nations' top court used that treaty to order the U.S. to ease some of its sanctions on the regime.

The International Court of Justice (ICJ) ruled earlier Wednesday that the U.S. must lift sanctions that affect the import of humanitarian goods and products and services linked to the safety of civil aviation. Iran had alleged that the sanctions breach the 1955 bilateral agreement known as the Treaty of Amity, from when the two countries had good relations, that regulates and promotes economic and diplomatic ties between the two countries.

The ICJ, ruling from the Hague, said in a preliminary decision that the U.S. must "remove, by means of its choosing, any impediments arising from" sanctions that affect exports to Iran of medicine, medical devices, food, agricultural commodities and equipment necessary to ensure the safety of civil aviation. The U.S. had argued that the sanctions cannot be challenged at the ICJ because it is a matter of national security. The court’s president, Abdulqawi Ahmed Yusuf, said that the case will continue and the U.S. could challenge the court's jurisdiction.

In his press conference, Pompeo said Iran's case was "meritless" and accused the country of "attempting to interfere with the sovereign rights of the United States to take lawful actions necessary to protect our national security and abusing the ICJ for political and propaganda purposes."

He then announced the U.S. would terminate the Amity treaty which formed the basis of Iran's suit against the U.S..

"This is a decision frankly that is 39 years overdue," he said, suggesting the U.S. should have pulled out of the treaty after the 1979 revolution in the country.

Although he said he was "disappointed" that the ICJ did not recognize the court had no jurisdiction, he argued the court's ruling was actually a "defeat for Iran."

"The court denied Iran's attempt to secure broad measures to interfere with U.S. sanctions and rightly noted Iran's history of non-compliance with its international obligations under the treaty of non-proliferation of nuclear weapons," he said. He also said that there are existing exemptions for humanitarians purposes in the sanctions regime.

Later, National Security Adviser John Bolton told reporters at a White House press briefing that the U.S. is withdrawing from an optional protocol on dispute resolution to the Vienna Convention on Diplomatic Relations. He said it was connected to a case brought by the Palestinian Authority challenging the U.S. decision to move its embassy in Israel to Jerusalem. Bolton later said the U.S. will review all international agreement that might expose the U.S. to "purported binding jurisdiction, dispute resolution" in the ICJ.

"The U.S. will not sit idly by as baseless, politicized claims are brought against us," he said.

President Trump pulled the U.S. out of the Obama-era Iran nuclear deal in May and reimposed a number of sanctions against the Islamic Republic in August. The U.S. intends to reimpose sanctions on the regime’s crude oil exports in November.

Last week, in a speech at the U.N. General Assembly, Trump promised that the U.S. "will pursue additional sanctions, tougher than ever before, to counter the entire range of Iran's malign conduct."

Iranian Foreign Minister Javad Zarif had hailed the ICJ ruling as a victory for Tehran in a tweet, where he described it as “another failure for sanctions-addicted [U.S. government] and victory for rule of law.”

“Imperative for int’l community to collectively counter malign US unilateralism,” he said.

TRUMP TRADES FIRE WITH IRANIAN LEADER AT UN GENERAL ASSEMBLY

Trump last week attacked the International Criminal Court, a separate court from the International Court of Justice. The ICC prosecutes those accused of war crimes, while the ICJ deals with disputes between countries.

At the General Assembly last week, Trump said that “the United States will provide no support in recognition to the International Criminal Court.”

“As far as America is concerned, the ICC has no jurisdiction, no legitimacy, and no authority,” he said. “The ICC claims near-universal jurisdiction over the citizens of every country, violating all principles of justice, fairness, and due process. We will never surrender America’s sovereignty to an unelected, unaccountable, global bureaucracy.”

Fox News’ Ben Evansky and The Associated Press contributed to this report.