Gibraltar has released the Iranian tanker Grace 1.

"Authorities in Gibraltar have released the Iranian supertanker Grace 1, which was seized on July 4 by British forces on suspicion it was shipping 2.1 million barrels of crude oil to Syria in breach of EU sanctions," reported the Gibraltar Chronicle.

Gibraltar authorities say they have written assurances from Iran that the tanker won't breach EU sanctions by offloading oil to Syria.

The ship will now head to Mediterranean ports, the deputy head of Iran's Ports and Maritime Organization, Jalil Eslami, was quoted as saying by the semi-official Mehr News Agency. He did not name the owner.

The chief justice of Gibraltar's Supreme Court, Anthony Dudley, confirmed earlier that the U.S. had applied to seize the tanker on Thursday. He said there was no U.S. application currently before the court.

The U.S. Justice Department sought to extend the detention of the tanker, prompting the territory's Supreme Court to adjourn a scheduled decision on whether to release the ship until later Thursday.

Gibraltar Chief Minister Fabian Picardo decided to lift the detention order after formal written assurances from Tehran that the ship would not discharge its 2.1 million barrels of oil in Syria.

"In light of the assurances we have received, there are no longer any reasonable grounds for the continued legal detention of the Grace 1 in order to ensure compliance with the EU Sanctions Regulation," Picardo said.

However, Gibraltar officials did not make clear whether the U.S. legal bid would mean the ship would have to be detained further or, if so, for how long.

In a statement, the State Department said the United States had determined that the ship was helping Iran's Islamic Revolutionary Guard Corps, which Washington has designated as a terrorist organization.

"In the case of the M/T Grace I, we will continue to act consistent with our existing policies concerning those who provide material support to the IRGC," the State Department said.

In a tweet Thursday, Iranian Foreign Minister Mohammad Javad Zarif accused the U.S. of trying to "steal our property on the high seas."

"This piracy attempt is indicative of [the] Trump [administration's] contempt for the law," he wrote.

The Grace 1 tanker was seized by Gibraltar authorities who suspected that it was carrying crude oil to Syria in violation of EU sanctions. (Jorge Guerrero/AFP/Getty Images)

British Prime Minister Boris Johnson's Downing Street office said Iran was discussed during the U.K. leader's meeting with U.S. President Donald Trump's national security adviser John Bolton earlier in the week, though no details were released on the talks.

Iran also seized British tanker

Shortly after the detention of the Grace 1, Iran seized 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.

But a spokesperson for the Stena Impero tanker said the situation remained the same with the British tanker and that the company awaited further developments from the U.K. and Iran.

In past weeks, the Persian Gulf region has seen six attacks on oil tankers that the U.S. has blamed on Iran and the downing of a U.S. surveillance drone by Iranian forces. Iran has denied being behind the tanker attacks. Iran also has seized other oil tankers.

A speedboat of the Iran's Revolutionary Guard helps seize the U.K.-flagged oil tanker Stena Impero on July 21, weeks after the British marines commandeered Iran's Grace 1 tanker near Gibraltar. (Hasan Shirvani/The Associated Press)

Speaking in court earlier Thursday morning, Dudley said were it not for the U.S. move, "the ship would have sailed," the Gibraltar Chronicle reported. Gibraltar had already released the Grace 1's captain, along with an Indian national and three officers, a signal that it was about to let the Iranian tanker go.

Having failed to accomplish its objectives through its <a href="https://twitter.com/hashtag/EconomicTerrorism?src=hash&ref_src=twsrc%5Etfw">#EconomicTerrorism</a>—including depriving cancer patients of medicine— the US attempted to abuse the legal system to steal our property on the high seas. <br><br>This piracy attempt is indicative of Trump admin's contempt for the law. —@JZarif

This is the second time the Trump administration tried to seize a ship in recent months. In May, the Justice Department announced that it had seized a North Korean cargo ship used to supply coal to the isolated nation in violation of EU sanctions.

Escalating tensions

Tensions have escalated in the Persian Gulf region since 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.

The U.S. has been asking its allies to take part in a naval mission to protect shipping in the strategic Strait of Hormuz, at the mouth of the Persian Gulf, though European nations have been reluctant.

Britain has so far been the only one to express willingness to join a maritime security mission. It has also been giving U.K.-flagged vessels a naval escort since the Iranian Revolutionary Guard's seizure of the Stena Impero in the Gulf.