Prior to the American Revolution, Great Britain had for years been paying tribute to the North African nations of Algiers, Tunis, Morocco and Tripoli, an area known as the Barbary Coast, in order to enjoy free commerce within the Mediterranean area. When the 1778 American alliance with France was signed, American vessels were protected by the French Navy from "violence, insults, attacks, or depredations" by the Barbary Pirates. After the Revolution, American vessels no longer had the protection of the French or British and thus became subject to pirate attacks, which involved capture of ships and crews followed by demands for ransom.
Presidents Washington and Adams were willing to pay tribute to the Barbary states on the grounds that it was cheaper to pay ransoms than to conduct wars against those nations. When Thomas Jefferson was minister to France and later Secretary of State, he expressed objections to paying ransom. Nevertheless, the United States paid almost one million dollars to gain the return of sailors from Algiers in 1795.
When Jefferson became president in 1801, the pasha of Tripoli demanded thousands of dollars in annual tributes, and when Jefferson refused, the pasha declared war on the United States. In his first annual message to Congress, Jefferson stated that although the nation had been blessed with a state of peace, one exception existed:
Tripoli, the least considerable of the Barbary States, had come forward with demands unfounded either in right or in compact. _ The style of the demand admitted but one answer. I sent a small squadron of frigates into the Mediterranean, with assurances to that power of our sincere desire to remain in peace, but with orders to protect our commerce against the threatened attack. The measure was seasonable and salutary. _ I wish I could say that our situation with all the other Barbary states was entirely satisfactory.
Toward the end of his first term Jefferson dispatched additional ships under Navy Commodore Edward Preble to the Mediterranean. Lt. Stephen Decatur destroyed the frigate Philadelphia, which the Tripolitan pirates had captured, and mercenaries and Marines led by Lieutenant Presley O'Bannon marched overland from Egypt and captured the city of Derna in Tripoli.31 A strong naval blockade brought the war to an end. Although the United States could not defeat all the Barbary states, the show of force induced the North African nations to show greater respect for American rights. Nevertheless, the United States continued to pay tribute to the other Barbary states until 1816, when Captain Decatur defeated the Dey of Algiers with a 10-ship American squadron. American prestige was on the line during those wars and was defended. However, the notion of "Millions for defense, but not one cent for tribute" in the XYZ Affair did not ring true. Americans paid tribute to pirates for years.