An Iranian flag flutters on board the Adrian Darya oil tanker, formerly known as Grace 1.

Tehran said Monday it has warned its arch-foe Washington against attempting to seize an Iranian tanker that has set sail from waters off Gibraltar after being impounded for six weeks.

Iran had been locked in a high-seas standoff with US ally Britain since Royal Marines seized the tanker off the coast of the British overseas territory Gibraltar on July 4 on suspicion it was shipping oil to Syria in breach of EU sanctions.

Little more than two weeks later, Iran's Islamic Revolutionary Guard Corps impounded the British-flagged Stena Impero tanker in strategic Gulf waters in what Britain called a tit-for-tat move.

A court in Gibraltar ordered the release of the Grace 1 on Thursday.

That was in spite of a last-minute US request to detain the ship on allegations of involvement in supporting illicit shipments to Syria by the Guards, listed as a terrorist group by Washington.

Gibraltar's government rejected the request, saying it could not seek a court order to detain the supertanker because US sanctions against Iran were not applicable in the European Union.

The tanker, bearing its new name the Adrian Darya and flying the Iranian flag, departed on Sunday evening for the Greek port of Kalamata, according to the monitoring website Marine Traffic.

But the final destination of the supertanker and its 2.1 million barrels of oil remains unclear, with authorities in Greece yet to confirm that it is expected to dock there.

As it finally sailed eastward on Monday, Iran said it had warned the United States through the Swiss embassy in Tehran, which represents US interests, against trying to seize it again.

"Iran has given necessary warnings to American officials through its official channels... not to make such a mistake because it would have grave consequences," said foreign ministry spokesman Abbas Mousavi.

'Bullying and unilateralism'

Speaking to reporters at a news conference, he dismissed the notion that there was a link between the seizure of the Iranian tanker off Gibraltar and the British-flagged tanker in the Gulf.

"There is no connection whatsoever between these two vessels," said Mousavi.

"There have been two or three maritime violations made by that ship," he said, referring to the British-flagged Stena Impero held off the Iranian port of Bandar Abbas.

"The court is looking into it. We hope the (investigation) is completed as soon as possible and the verdict is issued."

The Iranian spokesman said the Gibraltar court order for the release of the tanker was a blow to US "unilateralism".

"The Americans have not been very successful with their unilateral sanctions that have no legal basis.

"They should come to their senses that bullying and unilateralism cannot get anywhere in the world today."

Mousavi urged other countries not to accept sanctions the United States has imposed on Iran "because they're not legitimate and have no legal basis".

Tensions between Iran and its arch-foe the United States have been rising since President Donald Trump unilaterally withdrew the US from a landmark nuclear deal in May 2018 and began imposing sanctions against the Islamic republic as part of a "maximum pressure" campaign.

Iran has responded by suspending some of its commitments under the nuclear deal.

The situation has threatened to spiral out of control in the past few weeks with ships attacked, drones downed and oil tankers seized.

At the height of the crisis, Trump called off air strikes against Iran at the last minute in June after its forces shot down a US drone.

In its decision ordering the release of the tanker, Gibraltar said it had received written assurances from Iran that the ship would not be headed for countries "subject to European Union sanctions".

Iran denied it had made any promises about the ship's destination to secure the release.