The First Barbary War (1801–1805), also known as the Tripolitan War or the Barbary Coast War, was the first of two wars fought between the United States and the Northwest African Berber Muslim states known collectively as the Barbary States. These were Tripoli and Algiers, which were quasi-independent entities nominally belonging to the Ottoman Empire, and the independent Sultanate of Morocco.
The Barbary Wars... Credit to be given to then Sec of State, James Madison (& future US Pres) for sending military to defeat, what was essentially piracy. Tripoli was demanding $$ for safe passage of US fleet. He advised the military be deployed & with this experience they won their first war off US soul. The Marines hymn... For the halls of Montezuma to the shores of Tripoli refers to this victory. The war against Omar Gaddafi sometimes called 3rd Barbary War- Northern Africa.
In Barbary wars, did U.S. declare 'war on Islam'? | PolitiFact