The right of innocent passage has been discussed and tried to be explained in detail in both the 1958 Geneva Sea Law Conventions and the 1982 UNCLOS. In both texts, all states, whether coastal or not, can enjoy the right of innocent passage to use the seas comfortably.
When a ship with a foreign flag, using its right of innocent passage, continues to be subject to the jurisdiction of its flag state. As long as it does not violate the conditions of innocent passage while passing through the territorial sea or inland waters of a state other than the flag state.
The coastal state cannot charge a fee from a ship that is in innocent passage. It cannot legally or de facto discriminate between the states of which the ship is a member or between the states where the cargo carried by the ship is loaded, unloaded or carried on its behalf.
The ship, which has a technical problem, may seek assistance by approaching the nearest coastal border as required by international maritime law. However, in line with this request, the technical problem of the ship should be resolved and the ship cannot be detained from international transportation.
An unlawful military intervention is taking place on the civil oiler tanker. The ship detained from international shipping. The ship is unlawfully moored to the port and an investigation is opened. Then the cargo carried by the ship is taken to another ship and stolen.
We don't see this banditry anymore, even off the coast of Somalia. Only off the coast of West Africa and in the territorial waters of Greece. Their lawlessness is now beyond its borders.