When Britain was unable to compete with Spain, Portugal and the Netherlands for maritime hegemony, it began to take piracy actions. Hang the national flag of another country for fear of being discovered.
Later, because Britain was lucky enough to defeat the Spanish "Armada" and a series of maritime wars, Britain finally became the overlord at sea.