The oceans make up vast areas of the earth’s surface that are under no governmental control. That’s where maritime law comes into play. There are zones of the oceans that are controlled by the country on the nearest shore, but which laws they can enforce vary depending on how far away from the beach you are.
In international waters, some things depend on what country your ship is registered in. Other matters are rules agreed on by various nations, but it’s rare to get all nations to agree on anything. It gets confusing, but Wendover Productions makes it as simple as they can as they explain maritime law to us. -via reddit