The privateers worked for North African Muslim deys, or rulers, themselves subjects of the Ottoman Empire, which encouraged privateering as long as the empire received its share of tributes. Privateering had two aims: to enslave captives, who were usually Christian, and to ransom hostages for tribute.
The Barbary pirates played a significant role in defining the foreign policy of the United States in its earliest days. The pirates provoked the United States' first wars in the Middle East, compelled the United States to build a Navy, and set several precedents, including hostage crises involving the ransoming of American captives and military American military interventions in the Middle East that have been relatively frequent and bloody since.
The Barbary wars with the United States ended in 1815 after a naval expedition ordered to North Africa's shores by President Madison defeated the Barbary powers and put an end to three decades of American tribute payments. Some 700 Americans had been held hostage over the course of those three decades.
The term "Barbary" was a derogatory, European and American characterization of North African powers. The term is derived from the word "barbarians," a reflection of how Western powers, themselves often slave-trading or slave-holding societies at the time, viewed Muslim and Mediterranean regions.