From bases on the Barbary coast, North Africa, the Barbary pirates raided ships traveling through the Mediterranean and along the northern and western coasts of Africa, plundering their cargo and enslaving the people they captured.