A series of spinoffs of either the European-Turkish wars or the Napoleonic Wars, depending on how you look at it. Since the late Middle Ages a number of city-states centered themselves in the "Barbary Coast", or what is now Morocco based on a singular industry: piracy. These were collectively called the "Barbary Corsairs". During the Early-modern era this trade was becoming less respectable. However Europeans were throughout this era too busy with one another. Every once in awhile one of the larger powers would be irritated too much and send a fleet to punish them. But on the whole the smaller powers and even the larger powers, considered it easier to pay tribute.
In the 1780's a new nation known as America came to be. The Barbary Pirates thinking it vulnerable began to prey upon its commerce and demand tribute. The Americans were not in a mood for this and sent a series of punitive expeditions. America was short on naval resources at the time, and was hard put to it, but nevertheless it did well enough. This was interrupted by the War of 1812. After this, another American squadron came to visit the Barbary Coast. As The Napoleonic Wars were over, the Great Powers were now free to send their own contributions. First was the Royal Navy, and then finally the French, who simply conquered the Barbary Coast, ending the difficulty for good.
While this series of conflicts is generally forgotten by most modern audiences, especially given other major events taking place around the same time, it is immortalized somewhat in the US Marine Corps Hymn (the bit about the Shores of Tripoli) refers to the Marines' contribution to this conflict, which included an overland march from Egypt to lay siege to the city, as well as a daring raid on the captured USS Philadelphia to rescue her officers and burn the ship to deny it to the Tripolitans.)