Please see my last post.
Looking at the way you spelt 'gray', I will assume that you are not from the UK therefore you might not know that the UK is a dualist country and regards international law inferior to its own domestic laws. The same constitutional principles govern Gibraltar therefore, whatever is stated in international law - unless its transposed in its own law, will be disregarded insofar as its incompatible with its own law.
The power for law enforcement to arrest anything within its territory on reasonable grounds, I'm guessing, is a law of Gibraltar therefore the seizure of the ship was lawful. But even if its not, EU regulations have direct, legal effect in the EU, and the specific regulations in question apply not just to EU citizens but to all inside EU (and Gibraltan) territory. So it doesn't matter if the ship was Iranian, or the captain was Egyptian or any company involved is headquarted in China, EU law still requires the sanctions to be enforced.
You can read more about the applicability of EU sanctions here:
https://eeas.europa.eu/headquarters/headquarters-homepage/423/sanctions-policy_en
This is just not true. The link you posted details the legal relationship between the UK and the EU, but it confirms what I have said:
“EU sanctions apply within the jurisdiction (territory) of the EU; to EU nationals in any location; to companies and organisations incorporated under the law of a member state - including branches of EU companies in third countries; on board of aircrafts or vessels under member states´ jurisdiction.”
Read it, please.
The UK can take any view that it wants. It can arrest the Iranian vessel and it may even do so lawfully under national law. It cannot do so lawfully under international law, except under the provisions provided by international law.
Gibraltar and the UK signed and ratified the Convention on the Law of the Sea. Therefore, they are even in violation of their own national laws.
Once again, EU sanctions do not apply to non-EU states. International law takes precedence.