The vessel was seized in July because it was suspected to be in breach of EU sanctions.
But on Friday the Iranian foreign ministry has released a statement saying that: “Grace 1 tanker was not headed to Syria in the first place.”
Gibraltar Chief Minister Fabian Picardo decided to lift the detention order after Tehran confirmed in writing they would not discharge the oil in Syria.
“The Grace 1 is therefore now released from detention under the Sanctions Act by operation of law as confirmed this afternoon by the Chief Justice of the Supreme Court,” said the statement.
However, it remains unknown precisely when the tanker will leave Gibraltar.
Earlier on Thursday, the US government applied to block the release of the tanker.
A senior official with the Chief Minister of Gibraltar’s office told Euronews “The United States has applied to seize the vessel based on a number of allegations put to the Government of Gibraltar.
“Those allegations will be considered back in court today at 4 pm local time (CEST).”
The official did not reveal the nature of the allegations made.
Picardo said the US Department of Justice request for a new legal procedure to further detain the ship would be looked at by “the independent Mutual Legal Assistance authorities” who would “make an objective, legal determination of that request for separate proceedings”.
Iran’s ambassador to the UK, Hamid Baeidinejad, said the United States was “desperately” trying to block the release but faced a “miserable defeat”.
The Grace 1 and its crew were seized following a British Royal Navy operation in July after the tanker was suspected of violating EU sanctions on sending oil which could be used by the Assad government in Syria.
The tanker has been detained since July 4.
Gibraltar is an overseas territory of the United Kingdom on the southern tip of Spain.
The UK government has said it is up to Gibraltar to decide what to do and the court said it was seeking to “de-escalate” the situation with Iran.
It comes amid mounting tensions between the West and Iran after the US pulled out of the 2015 nuclear treaty last year.
The deal signed between Iran and the US, Russia, China, France, the UK and the European Union saw Tehran agreeing to eliminate its stockpile of nuclear-enriched uranium and submit to independent inspections in exchange for sanctions relief.
But in May 2018 Donald Trump announced the US would pull out of the deal and impose new sanctions on Iran.
The other powers vowed to continue with the agreement but last month Iran said it had exceeded the limit on the amount of low-enriched uranium it was allowed to hold under the terms of the deal.