Origin of the Q Flag
When the black death spread through Europe in late 1347, some ports began turning away ships suspected of coming from infected areas. In March 1348 Venice became the first to formalise such protective actions against plague. This was perhaps instigated in Venice as the lack of burial ground lead to the canals being choked with the victims.
They closed the city’s waters to suspect vessels and subjected travellers and legitimate ships to 30 days isolation. This was then extended to 40 days. Quaranta is the Italian for 40, Quarantina is 40 days and hence now we have the modern Quarantine.
Q Flag Protocol
The Q Flag “Quebec” in modern times indicates the opposite—a ship that declares itself free of quarantinable disease, and requests boarding and inspection by Port State Control to allow the grant of “free pratique”. The Q Flag must always be flown directly beneath the visiting country’s courtesy flag when entering the new country’s territorial water. It should be flown from the starboard spreader as are all other official flags. Remember “Port to Party”. The Q Flag should be left up until customs and immigration procedures have been completed. The Q Flag can then be removed and just the courtesy flag left flying. It is acceptable to lower your courtesy flag after sunset to reduce wear and tear.
To be totally correct no one bar the crew involved in immigration and customs should leave the yacht until the process is complete. Antigua in the Caribbean still enforce this, especially in Jolly Harbour. Passports have been confiscated and fines imposed for disobeying the rules. There are still a few countries where every one must remain on board until the officials contact the vessel.