Gibraltar has released an Iranian supertanker 'Grace 1'.
The tanker was seized by authorities there and British marines in the Mediterranean last month on suspicion of attempting to smuggle oil to Syria in breach of EU sanctions.
Authorities in Gibraltar have since received assurances from Tehran that the ship will not unload its cargo in Syria.
Gibraltar's chief minister Fabian Picardo said: "In light of the assurances we have received, there are no longer any reasonable grounds for the continued legal detention of the Grace 1 in order to ensure compliance with the EU Sanctions Regulation."
"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."
Iran's ambassador to London, Hamid Baeidinejad, says the Grace 1 tanker will leave Gibraltar soon.
Mr Picardo said an investigation had confirmed the Grace 1 was in fact intending to carry cargo to the Baniyas refinery in Syria.
The chief minister said he had provided evidence of this in a legal notice.
It comes after the US tried to stop the tanker's release, despite attempts by authorities in London to ease tensions with Iran.
Mr Baeidinejad said the US was "desperately" trying to block the release of the tanker, but they had faced a "miserable defeat".
In a tweet, Iran's Foreign Minister Mohammad Javad Zarif accused the US of "piracy".
"Having failed to accomplish its objectives through its #EconomicTerrorism-including depriving cancer patients of medicine- the US attempted to abuse the legal system to steal our property on the high seas," he said.
"This piracy attempt is indicative of Trump admin's contempt for the law."
Having failed to accomplish its objectives through its #EconomicTerrorism-including depriving cancer patients of medicine- the US attempted to abuse the legal system to steal our property on the high seas.
This piracy attempt is indicative of Trump admin's contempt for the law.
— Javad Zarif (@JZarif) August 15, 2019
The US made a late request to seize the vessel - and Mr Picardo said Gibraltar authorities "will make an objective, legal determination of that request for separate proceedings".