LONDON — A dramatic audio recording has emerged of the moments before Iran's Revolutionary Guard seized a British oil tanker in the Strait of Hormuz on Friday.

The radio exchanges reveal the British navy appearing to warn Iranian forces against seizing the Stena Impero tanker, a move that inflamed tensions amid renewed hostility between Iran and the West.

Meanwhile, a senior official in the government of Oman — which has often played a role as mediator in the region — told NBC News that Iran may have been reacting to the extended detention of one of its ships in the British territory of Gibraltar on Friday.

The recording from maritime security risk firm Dryad Global was obtained by NBC News on Sunday. The U.K.'s Ministry of Defence confirmed its authenticity to NBC News.

"If you obey, you will be safe," a member of the Iranian navy is heard telling the British-flagged tanker on the radio exchange, while demanding it change course.

A British naval officer aboard the HMS Montrose, according to a call sign referred to in the audio, responds with a warning to Iranian forces.

"Please confirm that you are not intending to violate international law by unlawfully attempting to board," the British voice says.

The HMS Montrose. Royal Navy / Ministry of Defence / via Reuters file

The warship also reminded the tanker's crew of their right to pass through the strait.

Responding to the Montrose's warning not to interfere, the Iranian boat says it is taking action for security purposes.

Iran's Revolutionary Guard later claimed in a statement that it had seized the Stena Impero for violating international regulations.

On Saturday the country's state TV released video that shows masked commandos rappelling onto the ship.

Earlier this month British Royal Marines seized a tanker believed to be carrying Iranian oil in Gibraltar under accusations that it was bringing the oil to Syria in violation of E.U. sanctions.

The Grace 1 tanker remains impounded in the British territory, which was granted the power on Friday to detain the ship for another month.

Iran’s Guardian Council described Friday's seizure of the British tanker as a "reciprocal action," according to FARS.

A senior Omani government official told NBC News that the country was in close touch with both London and Tehran.

"There was a decision by a court in Gibraltar on Friday morning to grant the U.K. government leave to detain the Iranian tanker held by them there for a further 30 days," the official said. "As the U.K. is quick to explain this is of course a judicial decision not under the control of the executive. However it may nevertheless have been the perceived provocation that brought about the Iranian action."

The official added: "We are of the clear view that both the U.K. and Iran wish to de-escalate the situation and so we are hopeful that the problem can be contained and resolved."

Britain has called Iran's seizure of the Stena Impero a "hostile act" and rejected Tehran's claims that the vessel had been involved in an accident with a fishing boat.

The senior Omani government official backed up the British claim, saying the ship was intercepted by the Iranians within Omani territorial waters and that no fishing accident or collision took place.

Foreign Minister Jeremy Hunt said on Saturday that he spoke to his Iranian counterpart Javad Zarif and "expressed extreme disappointment" after having been previously assured that Iran was working toward de-escalating the situation in the Gulf.

The seizure "shows worrying signs Iran may be choosing a dangerous path of illegal and destabilising behaviour," Hunt said.

On Sunday Iran's Ambassador to the U.K. cautioned Britain to "contain those domestic political forces" who are escalating tensions between the two countries "beyond the issue of ships."

"This is quite dangerous and unwise at a sensitive time in the region," Hamid Baeidinejad said on Twitter.

1/2 Yesterday's action in Gulf shows worrying signs Iran may be choosing a dangerous path of illegal and destabilising behaviour after Gibraltar’s LEGAL detention of oil bound for Syria. — Jeremy Hunt (@Jeremy_Hunt) July 20, 2019

Tensions between Iran and the United States have also intensified in recent weeks.

Senior U.S. officials said that U.S. Marines jammed an Iranian drone in the Gulf of Hormuz on Thursday, bringing it down and destroying it.

A U.S. surveillance drone was also shot down last month by Iran's Revolutionary Guard. In the aftermath of the incident, President Donald Trump confirmed that he was "cocked and loaded" to strike Iranian targets but decided to call the strikes off, saying the loss of life would make it a disproportionate response.

U.S. officials had earlier accused Tehran of a "blatant assault" on two burning tankers in the Gulf of Oman in June. Iranian officials denied any involvement in the attack on the tankers.

U.S. Central Command said in a statement Friday that it is developing a “multinational maritime effort” called Operation Sentinel to increase surveillance and security in what it said were key waterways in the Middle East.

Trump himself said on the South Lawn that U.S. officials will be working with the U.K. on the issue.

The president has withdrawn from 2015's landmark Iran nuclear agreement, imposed sanctions that squeezed the country's economy and designated the powerful Revolutionary Guard Corps as a foreign terrorist organization.

Iranian Foreign Minister Mohammad Javad Zarif said in an interview with NBC Nightly News’ Lester Holt on Monday that the door is “wide open” to diplomacy if Trump removes the array of sanctions he has imposed since 2017 that have slashed the country’s oil exports and damaged its economy.

“Once those sanctions are lifted, then ... the room for negotiation is wide open,” Zarif said during a visit to New York for a United Nations conference.

Zarif said he did not think the two countries were on the verge of war, saying neither his government nor Trump were seeking armed conflict.

“I do not believe that President Trump wants war. But I believe that people are around him who wouldn’t mind,” Zarif said.