LONDON — The authorities in Gibraltar on Thursday released an Iranian oil tanker they impounded six weeks ago, defying a United States request hours earlier to seize the ship. They also released the ship’s crew from detention.

Iran gave no immediate signal on whether it would soon release a British tanker that it had seized in retaliation, but Iranian officials have previously hinted at the possibility of such a trade. An oil trader in Iran who had been briefed on the dispute said that the British ship would be released once the Iranian tanker had reached Greece.

The moves were the latest sign that officials in Gibraltar, a semiautonomous British territory, Tehran and London, in negotiations over the past few weeks, were trying to step back from an escalating confrontation between Iran and the West, particularly the United States.

The Gibraltar government revealed on Thursday morning that the United States had applied to seize the Iranian vessel, Grace 1. The American action was 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.