LONDON — President Hassan Rouhani of Iran suggested Wednesday that his country might release a British-flagged tanker in exchange for the return of an Iranian ship seized by the British military off the coast of Gibraltar.

Iranian officials had previously implied such an offer might be forthcoming, describing the capture of the British tanker as “retaliation” for the British having impounded the Iranian vessel earlier this month. Britain has already said the Gibraltar court system controls the fate of the Iranian tanker.

Still, Mr. Rouhani’s explicit extension of the offer on Wednesday may have been a gesture toward reducing the escalating tensions between Iran and the West.

Speaking after a cabinet meeting in Tehran, Mr. Rouhani also alluded to indirect or behind-the-scenes talks about a potential easing of tensions between Iran and the United States.