Vessels have the right of freedom of navigation through straits, on “innocent passage” under the UN Convention on the Law of the Sea. As it sounds, that amounts to a right to pass straight through on normal business. Territorial waters do not affect innocent passage. The coastal state has the right to establish sea lanes for maritime safety purposes.
So whether the Marshall Islands flagged Maersk Tigris was in Iranian territorial waters is not relevant to its right to pass through. If, as Iranian sources have indicated, it really was impounded for commercial debt, then that would have to be in territorial waters. But for that the crew could not be detained, and the debt would have to be immediately stated and the ship released if paid. Iran is not acting as though this really is for debt.
The Maersk Tigris is however a good example of why the shipping industry is an absolute disgrace. It is flagged in a country with which neither the vessel nor its owners have any connection. It is owned by Maersk, leased to a renting company in Berlin, and then rented back by Maersk. The purpose of the flagging arrangements is to avoid proper safety, crew qualification, wage and trade union regulations which go with a genuine state flag. The leasing is an international tax fiddle. For reasons nothing to do with Iran or the US, I have no sympathy with the owners or insurers.
I rather expect the Iranians are lying about the commercial debt. Iran and the US are playing a pointless, massively expensive hawkish game in the Gulf. At least the Iranians have the excuse that they live there.
Just as Iran should not have stopped the passage of the Maersk Tigris, so the US Navy had no right at all recently to threaten Iranian cargo ships which may or may not have been on the way to Yemen. Even if those ships had entered Yemeni waters, the US would only have had the right to intervene if asked to do so by the government of Yemen. While that government is a Saudi and US puppet, they are not keen for all their people to know that. Giving permission for invisible blasts from the sky is much more deniable than for huge warships.
I was sorry for the two American hostages who were killdied in a drone strike, but sickened that given all the hundreds of innocent women and children he has murdered in drone strikes, Obama finally got all sackcloth and ashes over two American men.