The Barbary Wars were a series of two wars fought by the United States, Sweden, and the Kingdom of Sicily against the Barbary states (including Tunis, Algiers, and Tripoli) and Morocco of North Africa in the early 19th century. Sweden had been at war with the Tripolitans since 1800 and was joined by the newly independent U.S. The First Barbary War extended from 10 May 1801 to 10 June 1805, with the Second Barbary War lasting only three days, ending on 19 June 1815. The Barbary Wars were the first major American wars fought entirely outside the New World, and in the Arab World.
The wars were largely a reaction to piracy by the Barbary states. Since the 16th century, North African pirates had captured ships and even raided European coastal areas across the Mediterranean Sea. Originally starting out with the goal of capturing individuals for the domestic North African slave trade, the focus later shifted to kidnapping for ransom. By the 19th century, pirate activity had declined, but Barbary pirates continued to demand tribute from American merchant vessels in the Mediterranean. Refusal to pay would result in the capture of American ships and goods, and often the enslavement or ransoming of crew members.