It all starts with the Barbary corsairs (another word for what we would call a pirate or privateer)…
Quick terminology lesson:
Pirate: generally considered to not be affiliated with any nation, or displaying any strong national predilection, or distinction, between attacking one nation’s ships over another’s
Privateer: generally “licensed” by a governing official to lay siege on other nation’s ships and property, while sending a portion of the proceeds to their country
Most Barbary corsairs had either an official agreement, or an “understanding” with the port from which they sailed, which means they were, technically, privateers because they attacked only enemies of the state. The local rulers, called beys, typically offered privateering licenses to the corsairs in exchange for 10 percent of their profits plus port fees. Others, from smaller ports along the North African coast enjoyed a similar, although often less regimented, arrangement with the local government of their area.
Under their arrangement with the beys, the corsairs could attack any non-Muslim ships, particularly ships from countries with which the empire was at war, although this rule was not always strictly observed.
The Barbary pirates were based primarily out of various ports such as Morocco, Algiers, Tunis, and Tripoli (remember this). They seized ships and engaged in land raids of small coastal towns and villages throughout the Mediterranean, south along West Africa, and South America, and into the North Atlantic as far north as Iceland, but they primarily operated in the western Mediterranean area. The main purpose of their attacks was to capture Christian slaves for the Ottoman slave trade as well as the general Muslim slavery market in North Africa and the Middle East.
Up to this point, American commerce had been protected against the Barbary pirates by the peace treaty that Britain had with the four primary Barbary posts/ports (which America benefited from, being a colony of Britain colonies). But with their independence, the Americans lost that protection and fell prey to the corsairs. Unfortunately, as America had no warships to speak of, powerful naval forces, or large treasury, American commerce in the Mediterranean was promptly targeted by the Barbary corsairs. America’s merchants suffered, and the cries of families of men enslaved by the “barbarians” put pressure on the new Federal Government to come to terms. After years of negotiation, the United States agreed to pay tribute to keep American ships safe.
By the time President Thomas Jefferson took office, the United States had paid two million dollars in tribute. But once you start paying tribute (as anyone who has dealt with the mob will tell you) you set yourself up to demands for more tribute. The Pasha of Tripoli decided the $56,484 he had received wasn’t enough. He wanted $225,000, and an annual tribute of $20,000. When President Jefferson refused, the pasha declared war by cutting down the flagpole in front of the American consulate in Tripoli. A Barbary ruler could declare a peace treaty over (and therefore, declare war upon a country) by chopping down the flag outside of the rival nation’s embassy.
Between 1801 – 1805, the United States went to war against the Barbary pirates. This is known as the First Barbary War.
Interestingly enough, the Marine’s Hymn includes a reference to this war:
“From the Halls of Montezuma
To the shores of Tripoli;
We fight our country’s battles
In the air, on land, and sea;”