LONDON — The United States has applied to seize the Iranian oil tanker being held at Gibraltar, the government of the British territory revealed on Thursday, just as the authorities appeared to be close to releasing the ship they detained more than a month ago.
The American action is the latest in a series of back-and-forth jabs that the United States and Iran have traded recently, raising fears of escalation into an all-out conflict in the Persian Gulf.
Gibraltar freed the tanker’s Iranian crew from detention on Thursday, the latest sign that officials in the semiautonomous territory, Britain and Iran might be attempting to step back from the confrontation, possibly by agreeing to exchange seized vessels.
British marines and Gibraltar port officials seized the Iranian ship, Grace 1, on July 4, charging that it was carrying oil to Syria in violation of a European Union embargo. Iran quickly retaliated by detaining a British-flagged tanker, the Stena Impero, in the Strait of Hormuz, the narrow entryway to the Persian Gulf.
The Iranian government said this week that a deal was near for the release of Grace 1, which officials in Gibraltar and London would neither confirm nor deny; British officials insisted that it was a matter for the Gibraltar authorities. It was not clear whether such an agreement would include the release of the British ship.
A court in Gibraltar ruled last month that the Iranian vessel could be held for an additional 30 days, a period that will expire on Sunday. A follow-up hearing was set for Thursday morning, in which the territory’s government was not expected to ask the court to extend the detention.
But when the court met, Gibraltar officials revealed the United States request, and the hearing was adjourned until later in the day, according to The Gibraltar Chronicle, which first reported the developments.
“The U.S. 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 brief statement. “The matter will return to the Supreme Court of Gibraltar at 4 p.m. today.”
The legal basis for the request was not immediately clear, but the United States has recently imposed sanctions designed to cut off Iran’s ability to sell oil. Other countries have not signed onto those sanctions, but could face serious economic penalties for defying them.
Tankers carry about 20 percent of the world’s oil supply through the Strait of Hormuz to destinations around the world.
The area has become a flash point as tensions have risen between the United States and Iran since President Trump withdrew from a landmark 2015 nuclear deal and imposed sanctions that have hurt Iran’s economy.
American officials have blamed Iran for attacks in May and June that damaged several tankers in the region. In addition to the Stena Impero, Iran also seized a tanker registered in Panama in July — a vessel chartered by a company in the United Arab Emirates — and later said it had apprehended an Iraqi tanker.
Britain said this month that it would join an American-led mission to protect ships moving through the strait.
On Tuesday, the government of Gibraltar said it was seeking to “de-escalate issues arising since the lawful detention of Grace 1” but provided no details about what, if any, steps had been taken.
While Iran had hinted at an exchange, Dominic Raab, Britain’s new foreign secretary, recently ruled out that possibility, saying that a swap would legitimize the Iranian seizure.
“We are not going to barter a ship that was detained legally with a ship that was detained illegally,” Mr. Raab told Sky News during a summit meeting in Thailand. “That’s not the way that Iran will come in from the cold.”