A British-flagged tanker that Iran seized in July is now free to leave, Tehran said on Monday, more than a month after the British authorities released an Iranian tanker that had been detained off Gibraltar.

The news offered a rare sign of comity at a time when Iran has been in an escalating cycle of confrontation with its Persian Gulf neighbors and with the United States, including the shooting down of drones, the seizure of tankers and, most recently, an attack on major oil installations in Saudi Arabia.

Officials of the United States and Saudi Arabia, Iran’s chief rival in the region, have blamed Tehran for the Sept. 14 attack on oil centers in the kingdom, raising the prospect of retaliatory strikes and even war. But so far, the only apparent action they have taken against Tehran is a tightening of economic sanctions.

Iran had accused the British-flagged tanker, the Stena Impero, of violating maritime regulations in the Strait of Hormuz, but the seizure on July 19 was widely seen as retaliation for the detention of the Iranian vessel.