US request came shortly before a court in Gibraltar was expected to announce the tanker’s release.

The United States has sought to seize the Iranian Grace 1 tanker in Gibraltar, which was commandeered by British Royal Marines in the Mediterranean last month, the Gibraltar government has said.

Just hours before Gibraltar was due to release the Grace 1 vessel, the US Department of Justice sought to seize it.

“The US Department of Justice has applied to seize the Grace 1 on a number of allegations which are now being considered,” the Gibraltar government said in a statement on Thursday.

“The matter will return to the Supreme Court of Gibraltar at 4pm (14:00 GMT) today.”

The Gibraltarian court’s chief justice, Anthony Dudley, made clear that were it not for the US move, “the ship would have sailed”, the Gibraltar Chronicle reported.

The ship was seized on July 4 off the shore of Gibraltar on suspicion it was carrying Iranian crude oil to Syria in breach of European Union sanctions against the government of Syrian President Bashar al-Assad.

British Royal Marines boarded the vessel and arrested 28 crew members.

At the time, Tehran denied the accusation and described the detention an “act of piracy”.

Al Jazeera’s Andrew Simmons, reporting from Gibraltar, said the attorney general was “quite ruffled”.

“He [attorney general] told the judge that in the early hours of Thursday morning, there had been contact with the Department of Justice in the US … involving a supplemental request of detention parallel to the existing detention,” said Simmons.

“That really threw the judge off, who said that’s short notice and that detention request will have to be processed.

“The attorney general … had intended to do just the opposite [and release the vessel]”.

Earlier this week, Iran’s port authority had said the United Kingdom was considering freeing the oil tanker following the exchange of documents that were meant to help secure its release.

“The vessel was seized based on false allegations … it has not been freed yet,” Jalal Eslami, deputy head of Iran’s Ports and Maritime Organization, was quoted as saying on Tuesday.

Though it denied the report, a senior Gibraltar official said it was seeking to de-escalate issues arising with Iran since the detention of the Grace 1.

Two weeks after the seizure of Grace 1, Iran’s Revolutionary Guard Corps captured a UK-flagged, Sweden-owned, vessel for breaking “international maritime” rules in the Strait of Hormuz.

Tanker traffic through the Strait – where a fifth of the world’s oil passes – has become the focus of a standoff between Iran and the US, which has beefed up its military presence in the Gulf since May.

Al Jazeera’s Assed Baig, reporting from Tehran, said the move will likely “frustrate and anger” Iranian authorities.

“The voices coming out of Iran over the last few days were positive. They were confident this tanker would be released,” said Baig.

“The UK’s position has already been that this is a matter for Gibraltar authorities – but that seems to have changed now [that the US wants to intervene].”

Britain, which repeatedly ruled out any exchange and has since been giving UK-flagged vessels in the region a naval escort, joined a US-led security mission in the narrow passageway on August 5 in order to secure maritime traffic.

Iranian navy commander Rear Admiral Hossein Khanzadi repeated Iran’s longstanding demand that Western navies leave the Gulf, which Iran says should be patrolled only by the countries of the region, ISNA news agency reported on Thursday.