Battling the Barbary Pirates
North African pirates were menacing folks at least as far back as the Crusades. We have tales of them sailing as far north as Iceland, not only capturing merchant ships but plundering ports and taking captives for the slave trade.
It was the habit of European nations to pay tribute to the scoundrels, rather than fight them. Eventually, the pirates organized into North African Barbary States, controlling the eastern half of North Africa along the Mediterranean Sea. Their leaders got rich by extortion.
But things were about the change.
Before independence, American Colonial vessels were British, and protected by British payments to the pirates. After declaring independence, they were no longer covered by that deal, and the new nation had to pay their own tribute, which they did during the 1700s, over Thomas Jefferson’s objections.
Then Thomas Jefferson was elected president, and he declared there was to be no more tribute, and sent the American Navy and Marines to deal with matters.
It took some work, including landing Marines to assault a fortress in Tripoli, but eventually a treaty was worked out to protect American shipping. (Tripoli was the first American victory on foreign soil, with the Stars and Stripes flying over the fortress. The “Marine’s Hymn” still celebrates this with the line, “…from the shores of Tripoli.”)
America had to send the Navy in again after the War of 1812, but things were settled in very short order: an American flag meant the vessel was safe.