There is a potential conflict of interest between the flag state and the coastal state. The rights of a coastal state depend on zones at sea as defined by UNCLOS. These are territorial sea (3-12 nautical miles), the exclusive economic zone (12-200 miles), and the high seas (beyond 200 miles of the coast). Following the law of the sea, ships have the right to pass through territorial waters and beyond.
To avoid that ships face different construction and crewing standards in different territorial waters, UNCLOS states that coastal states legislation does not apply to design, construction, manning and equipment on foreign flag ships. Coastal states may impose restrictions only in special cases to secure safe navigation and hinder pollution. The coastal state may extend pollution regulation to the 200 miles, however.
The rise of port state control was a response to the increasing popularity of FOC. Some of these flags did not enforce international maritime regulations, which reduced the reliability of flag state control measures and induced a need for port state or coastal state control.
Port state control was formalised by the Paris MOU in 1982 when 14 European states agreed on a scheme to ensure that vessels comply with international conventions on safety and pollution. In total 27 countries have signed and are members of the Paris MOU. Participants to the MOU agree to inspect 25 per cent of foreign merchant vessels entering their ports. Paris MOU (2012) http://www.parismou.org/Organization/About_us/2010.12.28/Scope.htm . Other MOUs have been established: the Mediterranean MOU, the Tokyo MOU, the Caribbean MOU, the Latin American Agreement and the Indian Ocean MOU. USA has its national port control programme. IMO has established guidance on port state inspections to standardise such controls. Vessels that do not pass are detained in the port and lists of detained vessels are published.
Lloyds register of shipping give access to information on detained vessels at http://www.cdlive.lr.org/psc/psc.asp.