The First Barbary War (1801–5), was the first of the First Barbary War and the Second Barbary War fought between the United States and the North African Berber Muslim states known collectively as the Barbary States. For years the Barbary Corsairs had harassed and captured British, French and American shipping, often capturing vessels seizing cargoes and holding crews for large ransoms or enslaving them. Refusing to pay tribute President Thomas Jefferson sent a fleet of ships to the Mediterranean to deal with the constant threats to U.S. and other ships.