First Barbary War 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 Africa n 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 . Background and overview . Barbary corsair s and crews from the North African Ottoman provinces of Algiers , Tunis , Tripoli and the independent Sultanate of Morocco under the Alaouite Dynasty ( the Barbary Coast ) were the scourge of the Mediterranean . Capturing merchant ships and enslaving or ransoming their crews provided the Muslim rulers of these nations with wealth and naval power . The Roman Catholic Trinitarian Order or Order of " Mathurins " had operated from France for centuries with the special mission of collecting and disbursing funds for the relief and ransom of prisoners of Mediterranean pirates . According to Robert Davis , between 1 million and 1 . 25 million Europeans were captured by Barbary pirates and sold as slaves between the 16th and 19th centuries . Barbary corsairs led attacks upon American merchant shipping in an attempt to extort ransom for the lives of captured sailors , and ultimately tribute from the United States to avoid further attacks , much like their standard operating procedure with the various European states . Before the Treaty of Paris , which formalized United States ’ s independence from Great Britain , U . S . shipping was protected by France during the Revolutionary years under the Treaty of Alliance ( 1778 – 83 ) . Although the treaty does not mention the Barbary States in name , it refers to common enemies between both the U . S . and France , which would include the Barbary States or pirates in general . As such , piracy against U . S . shipping only began to occur after the end of the American Revolution , when the U . S . government lost its protection under the Treaty of Alliance . This lapse of protection by a European power led to the first American merchant shipping seized after the Treaty of Paris . On October 11 , 1784 , Moroccan pirates seized the brigantine " Betsey " . The Spanish government negotiated the freedom of the captured ship and crew ; however , Spain offered advice to the United States on how to deal with the Barbary States . The advice was to offer tribute to prevent further attacks against merchant ships . The U . S . Minister to France , Thomas Jefferson , decided to send envoys to Morocco and Algeria to try to purchase treaties and the freedoms of the captured sailors held by Algeria . Morocco was the first Barbary Coast state to sign a treaty with the U . S . on June 23 , 1786 . This treaty formally ended all Moroccan piracy against American shipping interests . Specifically , Article 6 of the treaty states that if any Americans captured by Moroccans or other Barbary Coast states docked at a Moroccan city , they would be set free and come under the protection of the Moroccan state . American diplomatic action with Algeria , the other major Barbary Coast state , was much less successful than with Morocco . Algeria began piracy against the U . S . on July 25 , 1785 with the capture of the schooner " Maria " and the " Dauphin " a week later . All four Barbary Coast states demanded $ 660 , 000 each . However , the envoys were given only an allocated budget of $ 40 , 000 to achieve peace . Diplomatic talks to reach a reasonable sum for tribute or for the ransom of the captured sailors struggled to make any headway . The crews of the " Maria " and " Dauphin " remained in captivity for over a decade , and soon were joined by crews of other ships captured by the Barbary States . In 1795 , Algeria came to an agreement that resulted in the release of 115 American sailors they held , at a cost of over $ 1 million . This amount totaled about of the entire U . S . budget , and was demanded as tribute by the Barbary States to prevent further piracy . The continuing demand for tribute ultimately led to the formation of the United States Department of the Navy , founded in 1798 to prevent further attacks upon American shipping and to end the extremely large demands for tribute from the Barbary States . Various letters and testimonies by captured sailors described their captivity as a form of slavery , even though Barbary Coast imprisonment was different from that practiced by the U . S . and European powers of the time . Barbary Coast prisoners were able to obtain wealth and property , along with achieving status beyond that of a slave . One such example was James Leander Cathcart , who rose to the highest position a Christian slave could achieve in Algeria , becoming an adviser to the Algerian Bey , or king . Even so , most captives were pressed into hard labor in the service of the Barbary pirates , and struggled under extremely poor conditions that exposed them to vermin and disease . As word of their treatment reached to the U . S . , through freed captives ' narratives or letters , Americans pushed for direct government action to stop the piracy against U . S . ships . In March 1785 , Thomas Jefferson and John Adams went to London to negotiate with Tripoli ' s envoy , Ambassador Sidi Haji Abdrahaman ( or Sidi Haji Abdul Rahman Adja ) . When they enquired " concerning the ground of the pretensions to make war upon nations who had done them no injury " , the ambassador replied : It was written in their Koran , that all nations which had not acknowledged the Prophet were sinners , whom it was the right and duty of the faithful to plunder and enslave ; and that every mussulman who was slain in this warfare was sure to go to paradise . He said , also , that the man who was the first to board a vessel had one slave over and above his share , and that when they sprang to the deck of an enemy ' s ship , every sailor held a dagger in each hand and a third in his mouth ; which usually struck such terror into the foe that they cried out for quarter at once . Jefferson reported the conversation to Secretary of Foreign Affairs John Jay , who submitted the Ambassador ' s comments and offer to Congress . Jefferson argued that paying tribute would encourage more attacks . Although John Adams agreed with Jefferson , he believed that circumstances forced the U . S . to pay tribute until an adequate navy could be built . The U . S . had just fought an exhausting war , which put the nation deep in debt . Federalist and Anti - Federalist forces argued over the needs of the country and the burden of taxation . Jefferson ' s own Democratic - Republican s and anti - navalists believed that the future of the country lay in westward expansion , with Atlantic trade threatening to siphon money and energy away from the new nation on useless wars in the Old World . The U . S . paid Algiers the ransom , and continued to pay up to $ 1 million per year over the next 15 years for the safe passage of American ships or the return of American hostages . A $ 1 million payment in ransom and tribute to the privateering states would have amounted to approximately ten percent of the U . S . government ' s annual revenues in 1800 . Jefferson continued to argue for cessation of the tribute , with rising support from George Washington and others . With the recommissioning of the American navy in 1794 and the resulting increased firepower on the seas , it became increasingly possible for America to refuse paying tribute , although by now the long - standing habit was hard to overturn . Declaration of war and naval blockade . " Immediately prior to Jefferson ' s inauguration in 1801 , Congress passed naval legislation that , among other things , provided for six frigates that ' shall be officered and manned as the President of the United States may direct . ' … In the event of a declaration of war on the United States by the Barbary powers , these ships were to ' protect our commerce & chastise their insolence — by sinking , burning or destroying their ships & Vessels wherever you shall find them . ' " On Jefferson ' s inauguration as president in 1801 , Yusuf Karamanli , the Pasha ( or Bashaw ) of Tripoli , demanded $ 225 , 000 from the new administration . ( In 1800 , Federal revenues totaled a little over $ 10 million . ) Putting his long - held beliefs into practice , Jefferson refused the demand . Consequently , on May 10 , 1801 , the Pasha declared war on the U . S . , not through any formal written documents but in the customary Barbary manner of cutting down the flagstaff in front of the U . S . Consulate . Algiers and Tunis did not follow their ally in Tripoli . In response , " Jefferson sent a small force to the area to protect American ships and citizens against potential aggression , but insisted that he was ' unauthorized by the Constitution , without the sanction of Congress , to go beyond the line of defense . ' " He told Congress : " I communicate [ to you ] all material information on this subject , that in the exercise of this important function confided by the Constitution to the Legislature exclusively their judgment may form itself on a knowledge and consideration of every circumstance of weight . " Although Congress never voted on a formal declaration of war , they did authorize the President to instruct the commanders of armed American vessels to seize all vessels and goods of the Pasha of Tripoli " and also to cause to be done all such other acts of precaution or hostility as the state of war will justify . " The American squadron joined a Swedish flotilla under Rudolf Cederström in blockading Tripoli , the Swedes having been at war with the Tripolitans since 1800 . On May 31 , 1801 Commodore Edward Preble traveled to Messina , Sicily to the court of King Francis of the Kingdom of the Two Sicilies . He sought help and found a good ally . The Kingdom was at war with Napoleon , but Francis supplied the Americans with manpower , craftsmen , supplies , gunboats , mortar boats , and the ports of Messina , Syracuse and Palermo to be used as a naval base to launch operations against Tripoli , a port walled fortress city protected by 150 pieces of heavy artillery manned by 25 , 000 soldiers , assisted by a fleet of 10 ten gunned brigs , 2 eight gun schooner s , 2 large galley s , and 19 gunboat s . The schooner ( commanded by Lieutenant Andrew Sterret ) defeated the 14 - gun Tripolitan corsair " Tripoli " after a fierce but one - sided battle on August 1 , 1801 . In 1802 , in response to Jefferson ' s request for authority to deal with the pirates , Congress passed " An act for the Protection of Commerce and seamen of the United States against the Tripolitan cruisers " , authorizing the President to " … employ such of the armed vessels of the United States as may be judged requisite … for protecting effectually the commerce and seamen thereof on the Atlantic ocean , the Mediterranean and adjoining seas . " " The statute authorized American ships to seize vessels belonging to the Bey of Tripoli , with the captured property distributed to those who brought the vessels into port . " The U . S Navy went unchallenged on the sea , but still the question remained undecided . Jefferson pressed the issue the following year , with an increase in military force and deployment of many of the Navy ' s best ships to the region throughout 1802 . The , , , , , , and all saw service during the war under the overall command of Commodore Edward Preble . Throughout 1803 , Preble set up and maintained a blockade of the Barbary ports and executed a campaign of raids and attacks against the cities ' fleets . Battles . In October 1803 , Tripoli ' s fleet was able to capture USS " Philadelphia " intact after the frigate ran aground while patrolling Tripoli harbor . Efforts by the Americans to float the ship while under fire from shore batteries and Tripolitan naval units failed . The ship , its captain , William Bainbridge , and all officers and crew were taken ashore and held as hostages . " Philadelphia " was turned against the Americans and anchored in the harbor as a gun battery . On the night of February 16 , 1804 , Lieutenant Stephen Decatur led a small detachment of U . S . Marines aboard the captured Tripolitan ketch rechristened USS " Intrepid " , thus deceiving the guards on the " Philadelphia " to float close enough to board her . Decatur ' s men stormed the ship and overpowered the Tripolitan sailors . With fire support from the American warships , the Marines set fire to " Philadelphia " , denying her use by the enemy . British Admiral Horatio Nelson , himself known as a man of action and courage , reportedly called this " the most bold and daring act of the age . " Preble attacked Tripoli on July 14 , 1804 , in a series of inconclusive battles , including a courageous but unsuccessful attack attempting to use USS " Intrepid " under Captain Richard Somers as a fire ship , packed with explosives and sent to enter Tripoli harbor , where she would destroy herself and the enemy fleet . However , " Intrepid " was destroyed , possibly by enemy gunfire , before she achieved her goal , killing Somers and his entire crew . The turning point in the war was the Battle of Derna ( April – May 1805 ) . Ex - consul William Eaton , a former Army officer who held the rank of general , and US Marine Corps First Lieutenant Presley O ' Bannon led a force of eight U . S . Marines , 500 mercenaries — Greeks from Crete , Arabs , and Berbers — on a march across the desert from Alexandria , Egypt to assault and to capture the Tripolitan city of Derna . This was the first time in history the United States flag was raised in victory on foreign soil . The action is memorialized in a line of the Marines ' Hymn — " the shores of Tripoli . " Peace treaty and legacy . Wearied of the blockade and raids , and now under threat of a continued advance on Tripoli proper and a scheme to restore his deposed older brother Hamet Karamanli as ruler , Yusuf Karamanli signed a treaty ending hostilities on June 10 , 1805 . Article 2 of the Treaty reads : The Bashaw of Tripoli shall deliver up to the American Squadron now off Tripoli , all the Americans in his possession ; and all the Subjects of the Bashaw of Tripoli now in the power of the United States of America shall be delivered up to him ; and as the number of Americans in possession of the Bashaw of Tripoli amounts to Three Hundred Persons , more or less ; and the number of Tripolino Subjects in the power of the Americans to about , One Hundred more or less ; The Bashaw of Tripoli shall receive from the United States of America , the sum of Sixty Thousand Dollars , as a payment for the difference between the Prisoners herein mentioned . In agreeing to pay a ransom of $ 60 , 000 for the American prisoners , the Jefferson administration drew a distinction between paying " tribute " and paying " ransom " . At the time , some argued that buying sailors out of slavery was a fair exchange to end the war . William Eaton , however , remained bitter for the rest of his life about the treaty , feeling that his efforts had been squandered by the State Department diplomat Tobias Lear . Eaton and others felt that the capture of Derna should have been used as a bargaining chip to obtain the release of all American prisoners without having to pay ransom . Furthermore , Eaton believed the honor of the United States had been compromised when it abandoned Hamet Karamanli after promising to restore him as leader of Tripoli . Eaton ' s complaints generally fell on deaf ears , especially as attention turned to the strained international relations which would ultimately lead to the withdrawal of the U . S . Navy from the area in 1807 and to the War of 1812 . The First Barbary War was beneficial to the military reputation of the U . S . America ' s military command and war mechanism , which had been up to that time relatively untested . The First Barbary War showed that America could execute a war far from home , and that American forces had the cohesion to fight together as Americans rather than separately as Georgians or New Yorkers . The United States Navy and Marines became a permanent part of the American government and American history , and Decatur returned to the U . S . as its first post - Revolutionary war hero . However , the more immediate problem of Barbary piracy was not fully settled . By 1807 , Algiers had gone back to taking American ships and seamen hostage . Distracted by the preludes to the War of 1812 , the U . S . was unable to respond to the provocation until 1815 , with the Second Barbary War , in which naval victories by Commodores William Bainbridge and Stephen Decatur led to treaties ending all tribute payments by the U . S . Monument . The " Tripoli Monument " , the oldest military monument in the U . S . , honors the heroes of the First Barbary War : Master Commandant Richard Somers , Lieutenant James Caldwell , James Decatur ( brother of Stephen Decatur ) , Henry Wadsworth , Joseph Israel and John Dorsey . Originally known as the " Naval Monument " , it was carved of Carrara marble in Italy in 1806 and brought to the U . S . as ballast on board the ( " Old Ironsides " ) . From its original location in the Washington Navy Yard , it was moved to the west terrace of the national Capitol and finally , in 1860 , to the U . S . Naval Academy in Annapolis , Maryland .