Madrid -- The United States moved on Thursday to seize an Iranian supertanker detained in Gibraltar for breaching international sanctions on oil shipments. The last minute intervention by Washington appeared set to thwart efforts by authorities in London and the British overseas territory to defuse tensions with Tehran, but in the end tiny Gibraltar decided to free the vessel.

The Gibraltar government confirmed that the U.S. Department of Justice had sought to extend the detention of the oil tanker Grace 1, but the Gibraltar Supreme Court later ruled to drop the detention order, with the U.S. request essentially being pushed to another government agency for consideration, and the supertanker free to leave/

In a statement released to the media, the senior government official in Gibraltar, Chief Minister Fabian Picardo, said that Iran had given formal assurances that the tanker would not carry petroleum products to Syria, in violation of EU sanctions, and thus "there are no longer any reasonable grounds for the continued legal detention of the Grace 1."

Get Breaking News Delivered to Your Inbox

Picardo acknowledged the separate U.S. request to detain the Grace, but said it was "a matter for our independent Mutual Legal Assistance authorities who will make an objective, legal determination of that request for separate proceedings. 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."

It was not immediately clear when the Grace 1 might actually leave the port in Gibraltar.

A European security boat approaches supertanker Grace 1 off the coast of Gibraltar, July 6, 2019. Getty

Neither the U.S. Justice Department nor the State Department responded to requests for comment.

Britain's Foreign Office said in a statement that the "investigations conducted around the Grace 1 are a matter for the government of Gibraltar" and that it could not comment further as the investigation was ongoing.

In Iran, Foreign Minister Javad Zarif called the U.S. move attempted "piracy."

"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," Zarif, who was recently sanctioned by the Trump administration, said in a tweet.

The detention of the Grace 1 saw Iran seize the British-flagged oil tanker Stena Impero, which remains held by the Islamic Republic. Analysts had hoped the release of the Grace 1 by Gibraltar would see the Stena Impero similarly released.

Reports by media in Gibraltar and Iran suggested earlier Thursday that the Grace was likely to be released, and the vessel's captain and senior officers were reportedly released from custody.

"The ship would have sailed"

The Grace 1 was seized last month in a British Royal Navy operation off Gibraltar. The vessel was suspected of violating European Union sanctions on oil shipments to Syria, and its seizure deepened international tensions in the Persian Gulf.

The Gibraltar government had said it was seeking to "de-escalate" the situation over the Grace 1.

Speculation of the pending released had mounted ahead of Thursday's hearings at the Gibraltar Supreme Court. A lawyer representing the territory's General Attorney Michael Llamas said the U.S. had moved at the eleventh hour.

The Gibraltar Chronicle reported that the captain and three officers of the Grace 1 were released from arrest on Thursday.

Speaking in court, Chief Justice Anthony Dudley said before the final decision was made that were it not for the U.S. move, "the ship would have sailed," the Chronicle reported.

Months of mounting tension

Tensions have escalated in the region since President Donald Trump over a year ago unilaterally withdrew the U.S. from Iran's 2015 nuclear deal with world powers. The decision stopped billions of dollars' worth of business deals, largely halted the sale of Iran's crude oil internationally and sharply depreciated Iran's currency, the rial.

In recent weeks, Iran has begun to step away from the nuclear deal by increasing its production and enrichment of uranium. It has threatened to take further steps in early September if Europe can't help it sell its oil abroad.

As CBS News correspondent Imtiaz Tyab reported from the Iranian city of Bandar Abbas on Wednesday, the Trump administration has sent mixed signals following a series of defiant actions by Tehran since the U.S. re-imposed harsh sanctions following its withdrawal from the nuclear deal.

In mid-June, Mr. Trump approved but then suddenly called off targeted airstrikes against Iran to retaliate for the Islamic Republic downing an American surveillance drone.

A month later the president was muted in his response to Iranian commandos seizing the British-flagged Stena Imperio.

The uncertainty over U.S. intentions isn't making life any easier for Iranians hit hard by the harsh economic sanctions, reported Tyab, and although some residents in Bandar Abbas told CBS News they're worried about a possible war, they all said it was the economy they're most concerned about.