The Barbary War - the first American war against Libya - was the first war waged by the United States outside national boundaries after gaining independence and unification of the country. The four Barbary States of North Africa - Morocco, Algiers, Tunis, and Tripoli - had plundered seaborne commerce for centuries. This was piracy on an extraordinary scale: they controlled all trading routes through the Barbary waters and North Africa: demanding ransom and booty for safe passage.
In 1801 the newly elected President Jefferson ordered a naval and military expedition to North Africa in order to put down regimes that endorsed piracy and slavery. The Pasha of Tripoli declared war on the United States. Under the leadership of Commodores Richard Dale and Edward Preble, the US Navy blockaded the enemy coast and engaged in close, bitterly contested gunboat actions. On 16 February 1804 LT Stephen Decatur led 74 volunteers into Tripoli to burn the captured American frigate The Philadelphia. British Admiral Lord Nelson called the raid "the most daring act of the age". In 1805 Marines stormed the Barbary pirates' harbor fortress stronghold of Derna (Tripoli), commemorated in the Marine Corp Hymn invocation "To the Shores of Tripoli."
The US Navy troops were recalled before they could secure their gains, but returned after the War of 1812. Their success then won worldwide admiration for the Americans and their Navy. They marked the way for the European nations to finally quash the Barbary States and end the piracy.
This event marks the true birth of the US Navy and Marines and is ever remembered in the Marines' battle hymn.