A roundup on Grace 1 being held at Gibraltar. I have done some research, it leaves more questions than answers, but seeing as there is no other source presenting this that I can find. I will just put the info down :
The UNCLOS which is the convention that accords innocent passage (the relevant clause in this case unless the ship was boarded earlier than claimed, in which case it is strait passage, high seas, Spanish territorial waters, or UK unclaimed territorial waters) is ratified by UK, Spain, and EU (within its limits to do so). It is signed but not ratified by Iran, and unsigned by Syria.
I do not know if its terms are applicable to Syria or Iran, I will guess they are applicable to all shipping, but am not sure if members are obliged.
The ship was deregistered by Panama a few days prior. I do not know if a ship without registry is respected within UNCLOS.
To look at that in some depth
Coastal State's Jurisdiction over Foreign Vessels
By Anne Bardin
The question of innocent passage and application of sanctions is not covered clearly anywhere that I can find. The EU position is that of only being party to anything as far as it is able to satisfy that with its other positions. There is no definition of EU territory beyond member state territory, no guideline to actions in territorial seas. This is a non position basically, it agrees to UNCLOS but it leaves member states to fulfil the terms to practical effect, it organises sanctions but leaves countries to apply them. So it is some kind of intermediary with influence but without responsibility. Unless somewhere it is documented that EU directly sanctioned the ship being detained (and this is insinuated by various sources, and in fact Fabian Picardo of Gibraltar made very clear in his address that he was in the act of transferring the ship to the responsibility of EU, the detention being under EU sanction law), it is not going to be seen as responsible until it accepts the detention for own handling. It can then probably either wash its hands and release, or do so by blaming UK but also assuming charge of the tanker, or simply ignore this facet if it thinks that there is no contest to it. The same goes with the fairness of existence of sanctions on Syria, it is always able to say they are not of it, but of the initiative of member states. If you did not know this side to how EU works, now you do.
The European Union and the United Nations Convention on the Law of the Sea
by Esa Parsivita
So for now it appears a UK choice of detention as sovereign act under EU sanctions law, with questions over UNCLOS respect. I do not know if the UN permits cessation of innocent passage as part of any UN sanctions ( there was a move to do so wrt Syria at one point) , but if it did it would not be applicable in this case as the EU sanction regime being used is not UN endorsed. Iran as owner has a European court that handles UNCLOS disputes to go to, or the UN.
At its simplest we are looking at if a ship can use territorial sea for passage when its purpose is illegal under the law of the nation whose territory it is. If a ship sets off with illegal cargo from a Spanish port for example, would Spanish customs be allowed to stop it within the territorial sea, or would it be enjoying innocent passage? The answer is not as obvious as it seems.
It is known that laws of the sea, specifically UNCLOS, are not firmly established in practice, in terms of there being an unquestioned order, the convention is relatively new in some of its contents, untested and sometimes contested.
Theory in Search of Practice: Right of Innocent Passage in the Territorial Sea
By William K. Agyebeng
Another point is the choice of the ship to head into UK territorial waters. A traditional route, shelter from weather and rest, replenishment of supplies, earlier boarding have all been mentioned. An info I picked up from a mainstream source (sorry no link) but that needs verification is that the marines who boarded were flown down from UK in advance, which suggests maybe that a stop was known to be planned, or other.
A longer comment (which is why I used text link) but it is relevant because not only are we looking at how these supranational frameworks interact, we are deducing their intent , basically how they coordinate and to what individual or collective purpose, and where individual countries are able to hide or manipulate with or from behind them.