Maritime Law Q re: North Korean ship in the Arabian Sea (Jodi?)

Obligatory link: http://news.bbc.co.uk/1/hi/world/middle_east/2566207.stm

On Monday, the Spanish Navy boarded a North Korean ship in the Arabian Sea. When they found scud parts, the whole thing was handed over to the US Navy. NPR was reporting on it this morning, and they repeatedly used the phrase “against the law.”

My question is…how does this law work? An East Asian ship in the Middle East is boarded by the navies of a European nation and a North American nation. Are all of these countries party to a maritime treaty? Who gives Spain and the US the right to pull over a ship of another country operating outside of their waters?

I remember Jodi mentioning that she’s interested specifically in maritime law, so I’m hoping she, or another of the SDMB lawyers can help me understand this.

Thank you!

The report I heard said the North Korean ship was not flying the flag of any country and its painted name had been obscured. Apparently, according to international law, this gives any country the right to stop and board the ship.

Chava