It has been a few years sense I studied maritime law for my seamanship corses but wouldn’t and attack on a tanker by Iran be construed as an act of war against whatever country the vessel was flagged under?
In theory, you mean?
Maybe.
Now give some recent example of starting the war for this reason within last 50 years?
In good old times, when maritime law was invented, the things were very much more simple.
British merchant vessel, had british crew, british flag, lloyds insurance, ship often armed with guns, etc.... Now, touch it if you dare.
But that was yesterday.
Today you have:
Foreign flag vessel (Bahama, Dutch Antilles, Malta, Singapore, Liberia etc - called flag of convenience)
Owned by western company, usually shareholders.
Given to technical operation managment to offshore company, in Cyprus or Singapore.
Manned by Indian, or Filipino or other crew.
And often rental under charter party, to any other cargo shipping company in any other country of similar structure.
That ship gets hijacked or targeted.
Which exact country will declare war? Send national army / navy? From Liberia? Or from Bahama?
Somali pirates (usually with impunity) proved states incompetence to defend their flag ships.
And Somali pirates were guys in slippers, boats with outboards, and AK47s.