Pirates of the Barbary Coast were preying on European and American shipping in the early 19th century, rather like Somalian pirates today, except that the Barbary pirates would often enslave the crews.
The U.S. Navy (including the Marines) played a major role in their defeat.