Flags are particularly important at sea, where they can mean the difference between life and death, and consequently where the rules and regulations for the flying of flags are strictly enforced. A national flag flown at sea is known as an ensign. A courteous, peaceable merchant ship or yacht customarily flies its ensign (in the usual ensign position), together with the flag of whatever nation it is currently visiting at the mast (known as a courtesy flag). To fly one's ensign alone in foreign waters, a foreign port or in the face of a foreign warship traditionally indicates a willingness to fight, with cannon, for the right to do so. As of 2009, this custom is still taken seriously by many naval and port authorities and is readily enforced in many parts of the world by boarding, confiscation and other civil penalties.
In some countries yacht ensigns are different from merchant ensigns in order to signal that the yacht is not carrying cargo that requires a customs declaration. Carrying commercial cargo on a boat with a yacht ensign is deemed to be smuggling in many jurisdictions. There is a system of international maritime signal flags for numerals and letters of the alphabet. Each flag or pennant has a specific meaning when flown individually. As well, semaphore flags can be used to communicate on an ad hoc basis from ship to ship over short distances. Traditionally, a vessel flying under the courtesy flag of a specific nation, regardless of the vessel's country of registry, is considered to be operating under the law of her 'host' nation.
Another category of maritime flag flown by some United States Government ships is the distinguishing mark. Although the United States Coast Guard has its own service ensign, all other U.S. Government ships fly the national ensign their service ensign, following United States Navy practice. To distinguish themselves from ships of the Navy, such ships historically have flown their parent organisation's flag from a forward mast as a distinguishing mark. Today, for example, commissioned ships of the National Oceanic and Atmospheric Administration (NOAA) fly the NOAA flag as a distinguishing mark.