It is difficult to find any time since the Byzantine Empire when the North African coast from Morocco to Libya was not infamous for piracy. The worst period was the beginning of the sixteenth century to the end of the eighteenth. The Berbers, who may or may not have originally populated the Canary Islands, were piratical by nature and good navigators in the treacherous Atlantic and unpredictable Mediterranean.
Algeria, Tunisia and Tripolitania (Libya) take their name from the infamous pirate Barbarossa. Even the English adjective barbaric has its roots in berber, bereber or Barbarossa.
In the centuries mentioned most of the seven main islands of the Canaries were used as bases by pirates of all nationalities, especially French. English pirates preferred to maintain bases in the Caribbean – Jamaica for instance, and Tortuga.
The Barbary Wars were a series of intermittent bloody skirmishes between United States navy and marine forces and the pirates, as the US began to flex its considerable muscles and show poor pathetic old Europe how to deal with criminals – especially those who sailed ships with the Skull and Crossbones flying. These were the early years of the nineteenth century, and the pirates operated still, from their bases in Morocco, Tunis, Tripoli and Algiers. Just as Elizabeth I of England had encouraged (and frequently financed) her ‘gentleman adventurers’ three centuries before, the rulers of Morocco etc. applauded the exploits of the pirates, took the lion’s share of the proceeds, and in addition demanded protection money (‘tribute payments’) from other countries to protect their shipping from attack! The Corleones would have been pleased, but it was only business.
The United States had at first paid up, but when both the Pasha of Tripoli and the Dey of Algeria doubled their demands in 1801 it was too much and the Great Growling Bear of the growing States sent warships on punitive expeditions; naturally they won several quick victories. The Americans then arranged sound treaties which permanently ended piratical attacks on US shipping. The ‘Barbary Coast’ rapidly lost its black reputation, and the buccaneers had to look west and east for their victims, to the Caribbean, where they were unwelcome and well thrashed, and the South China Sea, where they flourished until wiped out by the White Rajah Brooke (q.v.) . The epoch of the ‘Pyrates’ had ended; one of them even became Governor of Jamaica.