A UK-flagged oil tanker that has been held by Iran for weeks is free to leave, an official in Tehran was quoted as saying, bringing to a possible end a months-long standoff sparked by the British capture of an Iranian vessel.

The impending release of the ship comes as Boris Johnson endorsed US allegations that Iran was behind a 14 September attack on a major Saudi facility, hedging the accusation with calls to de-escalate a standoff in the Middle East between Tehran and Washington and their allies.

“I can tell you that the UK is attributing responsibility with a very high degree of probability to Iran for the Aramco attacks,” the prime minister was quoted as saying.

The Swedish Stena Impero was captured by Iranian officials two weeks after the UK and its partners in Gibraltar seized a ship loaded with Iranian fuel for alleged violations of European Union sanctions on trade with Syria and at the behest of hardline US officials seeking to apply a policy of “maximum pressure” on Iran.

Iran responded by seizing the Stena Impero on various vague and contradictory allegations, releasing some members of the crew earlier this month.

In photos: British-flagged tanker seized by Iran Show all 13 1 /13 In photos: British-flagged tanker seized by Iran In photos: British-flagged tanker seized by Iran A speedboat of Iran's Revolutionary Guard moving around the British-flagged oil tanker Stena Impero Tasnim News Agency/AP In photos: British-flagged tanker seized by Iran Crew members of the British-flagged tanker Stena Impero, that was seized by Iran in the Strait of Hormuz EPA/IRIB News Agency In photos: British-flagged tanker seized by Iran A satellite image of the Iranian port city of Bandar Abbas reveals the presence of the seized British oil tanker, the Stena Impero on July 22 Maxar Technologies/Reuters In photos: British-flagged tanker seized by Iran Iranian Revolutionary Guard Corps (IRGC) claims to have seized Stena Impero at the Strait of Hormuz with 23 crew on board on 20 July EPA/IRIB News Agency In photos: British-flagged tanker seized by Iran Iranian Revolutionary Guards patrolling around the captured British-flagged tanker Stena Impero as it's anchored off the Iranian port city of Bandar Abbas AFP/Getty In photos: British-flagged tanker seized by Iran epa07733612 A handout photo made available by Iranian state-run IRIB News Agency on 22 July 2019 shows crew members of the British-flagged tanker Stena Impero, that was seized by Iran in the Strait of Hormuz on 19 July 2019. Iranian Revolutionary Guard Corps (IRGC) claims to have seized Stena Impero at the Strait of Hormuz with 23 crew on board on 20 July 2019. EPA/IRIB NEWS AGENCY / HANDOUT HANDOUT EDITORIAL USE ONLY/NO SALES IRIB NEWS AGENCY / HANDOUT EPA/IRIB News Agency In photos: British-flagged tanker seized by Iran A satellite image of the Iranian port city of Bandar Abbas reveals the presence of the seized British oil tanker, the Stena Impero on July 22 Maxar Technologies/Reuters In photos: British-flagged tanker seized by Iran A speedboat of the Iran's Revolutionary Guard moves around a British-flagged oil tanker Stena Impero AP In photos: British-flagged tanker seized by Iran epa07733614 A handout photo made available by Iranian state-run IRIB News Agency on 22 July 2019 shows crew members of the British-flagged tanker Stena Impero, that was seized by Iran in the Strait of Hormuz on 19 July 2019. Iranian Revolutionary Guard Corps (IRGC) claims to have seized Stena Impero at the Strait of Hormuz with 23 crew on board on 20 July 2019. EPA/IRIB NEWS AGENCY / HANDOUT HANDOUT EDITORIAL USE ONLY/NO SALES IRIB NEWS AGENCY / HANDOUT EPA/IRIB News Agency In photos: British-flagged tanker seized by Iran In this photo released by state-run IRIB News Agency, which aired on Monday, July 22, 2019, shows cooks in the galley of the British-flagged tanker Stena Impero that was seized by Tehran in the Strait of Hormuz on Friday. The Associated Press cannot independently verify the condition of the crew members, but in the video they looked to be in good health and it didn't appear as though they were being filmed under duress. (IRIB News Agency via AP) AP In photos: British-flagged tanker seized by Iran epa07733619 A handout photo made available by Iranian state-run IRIB News Agency on 22 July 2019 shows crew members of the British-flagged tanker Stena Impero, that was seized by Iran in the Strait of Hormuz on 19 July 2019. Iranian Revolutionary Guard Corps (IRGC) claims to have seized Stena Impero at the Strait of Hormuz with 23 crew on board on 20 July 2019. EPA/IRIB NEWS AGENCY / HANDOUT HANDOUT EDITORIAL USE ONLY/NO SALES IRIB NEWS AGENCY / HANDOUT EPA/IRIB News Agency In photos: British-flagged tanker seized by Iran epa07733613 A handout photo made available by Iranian state-run IRIB News Agency on 22 July 2019 shows crew members of the British-flagged tanker Stena Impero, that was seized by Iran in the Strait of Hormuz on 19 July 2019. Iranian Revolutionary Guard Corps (IRGC) claims to have seized Stena Impero at the Strait of Hormuz with 23 crew on board on 20 July 2019. EPA/IRIB NEWS AGENCY / HANDOUT HANDOUT EDITORIAL USE ONLY/NO SALES IRIB NEWS AGENCY / HANDOUT EPA/IRIB News Agency In photos: British-flagged tanker seized by Iran epa07733616 A handout photo made available by Iranian state-run IRIB News Agency on 22 July 2019 shows crew members of the British-flagged tanker Stena Impero, that was seized by Iran in the Strait of Hormuz on 19 July 2019. Iranian Revolutionary Guard Corps (IRGC) claims to have seized Stena Impero at the Strait of Hormuz with 23 crew on board on 20 July 2019. EPA/IRIB NEWS AGENCY / HANDOUT HANDOUT EDITORIAL USE ONLY/NO SALES IRIB NEWS AGENCY / HANDOUT EPA/IRIB News Agency

Gibraltar ordered the release of the Iranian vessel, renamed the Adrian Darya 1​, after the UK secured a promise from Tehran that the oil aboard would not be sold to Syria, a vow Tehran appears to have violated.

Iran now says the Stena Impero is permitted to leave the country’s Persian Gulf port of Bandar Abbas, though it remains unclear when it would do so.

“The legal procedures related to the oil tanker are completed now, and regardless of the violations it committed, it is free to go,” government spokesman Ali Rabiei was quoted as saying by Iran’s semi-official Fars News Agency. “The decisions indicate the end of the seizure.”