LONDON -- Taken on its own, Iran's seizure of a British-flagged oil tanker in the Strait of Hormuz may seem like a brazen act of aggression, a provocative poke in the nose to both Britain and its ally, the United States.

But Iran seems to view the armed takeover of the Stena Impero as a carefully calibrated response to the July 4 taking of an Iranian supertanker off the coast of Gibraltar, an operation in which Britain's Royal Marines played a major role.

Though the official reasons for the takeovers differ, it's fairly clear now that the seizure of the British vessel may give Tehran more leverage to get its own ship back.

While Britain says it acted near Gibraltar because the Iranian tanker Grace 1 was busting sanctions by delivering oil to Syria, Iran says it intervened because the British-flagged tanker hit an Iranian fishing boat.

The current tensions between Iran and the West have been escalating since U.S. President Donald Trump withdrew the U.S. last year from the 2015 nuclear deal with Tehran with world powers and imposed sweeping economic sanctions on Iran, including its oil exports. The 2015 accord, of which Britain was a signatory, was designed to prevent Iran from developing nuclear weapons in return for a lifting of sanctions.

Tensions have risen further since May, when the U.S. announced it was dispatching an aircraft carrier and additional troops to the Middle East, citing unspecified threats posed by Iran.

With the U.S. sanctions hitting the Iranian economy hard, Tehran is desperate for economic support and has been urging Britain, France and Germany to cobble together a package that will keep the nuclear deal on track.

Veteran British diplomat Malcolm Rifkind, who served as British foreign secretary and defence secretary in the 1990s, says Iran sees its action against the Steno Impero as a direct result to the U.K.'s involvement in the takeover of the Grace 1.

"From the point of view of the Iranians, there is a direct relationship," he told The Associated Press Saturday. "They were very, very angry at being caught out. But the Royal Navy was not acting against Iran; it was acting against Syria to enforce sanctions. But the Iranians don't see it that way."

Rifkind says Iran may carry its "macho" actions too far and make it harder for Britain to continue with efforts to keep the nuclear accord alive.

Iran made the link between the two separate seizures this month explicit on Saturday.

"The rule of reciprocal action is well-known in international law," the semi-official Fars news agency quoted Abbas Ali Kadkhodaei, a spokesman for Iran's Guardian Council, as saying.

He said Iran made the right decision in the face of an "illegitimate economic war and seizure of oil tankers."

The precise timing may have been a coincidence, but it's a fact that Iran took action against the Stena Impero only hours after the government of Gibraltar -- a British overseas territory -- said it would continue to hold the Iranian tanker and its precious crude oil cargo, rejecting Iran's demands for its immediate return.

The action against the Stena Impero, carried out by high speed patrol boats with a helicopter overhead, could hardly have been a surprise. Iran's leaders have publicly called Britain's seizure of the Grace 1 an act of "piracy" and warned they were considering taking a British tanker in retaliation.

Britain has offered to have the Iranian supertanker released if Iran pledges not to deliver the crude oil to Syria, an approach that has not borne fruit. A Gibraltar government hearing on the matter is set for August 15.

The hope has to be that a diplomatic solution -- the release of both seized vessels, with cargo and crew intact and unharmed, for example -- can defuse this latest escalation in one of the most important sea passages on the planet.