DUBAI, United Arab Emirates — An Iranian tanker was headed toward Greece on Monday after it was released from detention off Gibraltar, and Tehran said any U.S. move to seize the vessel would have "heavy consequences."

The Grace 1, renamed the Adrian Darya 1, left Gibraltar about 11 p.m. (2100 GMT) on Sunday. Refinitiv ship tracking data showed early Monday that it was heading through the Mediterranean to Kalamata in Greece.

British Royal Marines seized the tanker near Gibraltar on July 4 on suspicion it was carrying oil to Syria in violation of European Union sanctions. The seizure led to a weekslong stand-off between Tehran and the West and heightened tensions on international oil shipping routes through the Gulf.

Lester Holt is anchoring “NBC Nightly News” tonight from Tehran, Iran. Watch at 6:30 p.m. ET / 5:30 p.m. CT, or check your local NBC station.

Gibraltar, a British overseas territory, lifted the detention order on Thursday, but a federal court in Washington on Friday issued a warrant for the seizure of the tanker, the oil it carried and nearly $1 million.

Gibraltar said Sunday it could not comply with that request because it was bound by E.U. law. Washington wanted to detain the Grace 1 on the grounds that it had links to Iran's Islamic Revolutionary Guard Corps, which it has designated a terrorist organization.

Greek authorities had no immediate comment.

Iran said Monday that any U.S. attempt to seize the tanker would have "heavy consequences."

Asked whether the United States could renew its seizure request after the tanker sailed from Gibraltar, Foreign Ministry Spokesman Abbas Mousavi said: "Such an action, and even the talk of it ... would endanger shipping safety in open seas."

"Iran has issued the necessary warnings through official channels, especially the Swiss embassy, to American officials not to commit such an error because it would have heavy consequences," Mousavi said in remarks broadcast on state television.

Switzerland represents U.S. interests in Iran, which has no diplomatic relations with the United States.

Separately, a senior Iranian lawmaker said a crisis in Iran's ties with Britain, which included Tehran's seizure of a British-flagged tanker last month, would not be over until the tanker reached its destination.

Two weeks after the Grace 1 was commandeered, Revolutionary Guards on July 19 seized the Stena Impero in the Strait of Hormuz for alleged marine violations.

"Until the Iranian oil tanker arrives at its destination, the British must help end the crisis," Heshmatollah Falahatpisheh, a member of Parliament's national security and foreign affairs committee, was quoted as saying by the semi-official ISNA news agency.

"This means that the crisis with Britain is not over. Britain has the primary responsibility for ending the oil tanker crisis," Falahatpisheh said.

Mousavi said that Tehran was waiting for a court decision on alleged maritime violations by the Stena Impero and he hoped it would be completed as soon as possible.

Iran has denied its tanker was ever headed to Syria, a close ally of Tehran.

The two vessels have since become pawns in a bigger game, feeding into wider hostilities since the United States last year pulled out of an international agreement to curb Iran's nuclear program and reimposed economic sanctions.