(CNN) A seized oil tanker at the center of a standoff between the UK and Iran is free to set sail, despite eleventh-hour efforts by the United States to halt the move to release it.

The Supreme Court in the British territory of Gibraltar approved the release of the Grace 1 , which was seized off the country's coast by authorities last month, after officials said they no longer wished to detain it.

Gibraltar said it had received assurances from Iran and the owners of the oil that, were the tanker to be released, its cargo would not be taken to Syria, which would be in breach of European Union sanctions.

The ship was boarded six weeks ago as it passed through Gibraltar's territorial waters. Two weeks later, Iran seized a British ship in the Gulf, in what was widely regarded as a tit-for-tat operation.

As tensions increased, the two sides conducted delicate negotiations in London. "Gibraltar has taken a very careful approach to the detention of Grace 1," Gibraltar's Chief Minister Fabian Picardo told CNN "We only acted in July when we had evidence that the cargo aboard the vessel was going to Syria."

"What we found aboard the vessel has confirmed the view that we took was the correct view. We have only released the vessel... when we have been convinced that the vessel is not now going to Syria," he added.

Grace 1's owner said the released Iranian tanker would head to the Mediterranean, according to Iran's semi-official Mehr News Agency, citing Iranian Maritime official Jalil Eslami. It was unclear when the supertanker would depart.

On Friday, Iran disputed Gibraltar's account and insisted it had made no commitments to secure the tanker's release.

"Iran has made no commitment that the ship would not go to Syria because from the early hours of the tanker's detention, we announced that Syria was not its destination and we have upheld the same ... and reiterated that it was nobody's business even if it was Syria," the country's Foreign Ministry spokesman Seyed Abbas Mousavi said according to semi-official Tasnim news.

According to Tasnim, Mousavi said that the Gibraltar government "raised the issue of commitment in a bid to make up for their humiliation caused by this illegal act and piracy."

"We support Syria in all areas, including oil and energy," Mousavi said, adding, "This is legal and has nothing to do with any third country."

'Piracy attempt'

A last-minute intervention by the US threatened to scupper the plan to release the Grace 1. In a court hearing Thursday morning, instead of announcing the release of the tanker, the Gibraltar attorney general's lawyer Joseph Triay said the US Department of Justice had applied to extend its seizure. The basis of Washington's legal efforts was unclear Thursday. The State Department referred CNN to the Department of Justice, which declined to comment.

The court adjourned until later Thursday afternoon, when the release of the Grace 1 was confirmed.

Picardo told CNN that Gibraltar was still looking at the request from the US and "making an independent assessment" of it. That review had not been completed ahead of Thursday's court hearings "but could of course come at any time before the vessel sails." Picardo declined to elaborate on the basis of the US request to extend the seizure of the vessel.

A stern view of the Grace 1 super tanker in the British territory of Gibraltar on Thursday.

Iran's Foreign Minister Javad Zarif denounced the US move as a "piracy attempt" in a post on Twitter

Tehran's ambassador to the UK, Hamid Baeidinejad, said the Grace 1 would leave Gibraltar soon. "The US in a last minute attempt made a futile effort to block the release of the oil tanker and were faced with humiliating defeat. With recent attempts, all necessary preparations and technical issues to release the tanker to an open sea have been arranged and the ship will soon leave Gibraltar," he wrote on Twitter, in Farsi.

The US reacted to the release by threatening to revoke visas for the Grace 1's crew. The State Department said in a statement late Thursday that it had deemed the ship to be "assisting" Iran's Islamic Revolutionary Guard Corps (IRGC), which the US has designated a Foreign Terrorist Organization, in evading sanctions.

"Crewmembers of vessels assisting the IRGC by transporting oil from Iran may be ineligible for visas or admission to the United States under the terrorism-related inadmissibility grounds in Section 212(a)(3)(B) of the Immigration and Nationality Act," the State Department said.

British Royal Marines and Gibraltar port and law enforcement agencies stormed the ship on July 4. It was accused of carrying oil destined for Syria, which would have been in violation of EU sanctions.

Spain's acting foreign minister, Josep Borrell, said at the time that the United States had asked the UK to intercept the ship. Gibraltar is a British overseas territory on the edge of southern Spain.

Crew members stand on the Grace 1 supertanker earlier on Thursday.

Iran criticized the seizure as "illegal" and condemned the operation as "piracy." Less than two weeks later, Iran's Islamic Revolutionary Guard Corps (IRGC) captured the British-flagged Stena Impero in the Strait of Hormuz and accused it of "violating international regulations."

A spokesperson for the Stena Impero's owners said that the Grace 1 "is an entirely separate situation from our perspective" but its release "could be seen as a positive step" for the Stena Impero.

In response to the court's decision, the UK government said Thursday that Iran must abide by the assurances given to Gibraltar.

"We will not stand by and allow Iran -- or anyone -- to bypass vital EU sanctions on a regime that has deployed chemical weapons against its own people," a UK Foreign Office spokesperson said in a statement.

The spokesperson added that there is "no comparison or linkage between Iran's unacceptable and illegal seizure of, and attacks on, commercial shipping vessels in the Strait of Hormuz and the enforcement of EU Syria sanctions by the Government of Gibraltar."

Prior to the seizures, tensions in the Persian Gulf had been steadily escalating after Iran confirmed it would stop complying with several parts of the 2015 nuclear deal, which the Trump administration withdrew from last year.

This story has been updated to clarify that Joseph Triay is the Gibraltar attorney general's lawyer.