Second Barbary War The Second Barbary War ( 1815 ) , also known as the Algerine or Algerian War , was the second of two wars fought between the United States and the Ottoman Empire ' s North Africa n regencies of Tripoli , Tunis , and Algeria known collectively as the Barbary states . The war between the Barbary States and the U . S . ended in 1815 ; the international dispute would effectively be ended the following year by Great Britain and the Netherlands . The war brought an end to the American practice of paying tribute to the pirate states and helped mark the beginning of the end of piracy in that region , which had been rampant in the days of Ottoman domination ( 16th – 18th centuries ) . Within decades , European powers built ever more sophisticated and expensive ships which the Barbary pirates could not match in numbers or technology . Background . After the First Barbary War ( 1801 – 1805 ) , the U . S . found its attention diverted to its worsening relationship with Great Britain over trade with France , which culminated in the War of 1812 . The Barbary pirate states took this opportunity to return to their practice of attacking American , as well as European merchant vessels in the Mediterranean Sea and holding their crews and officers for ransom . At the same time , the major European powers were still involved in the Napoleonic Wars which did not fully end until 1815 . United States ' response . At the conclusion of the War of 1812 , however , America could once again turn its sights on North Africa . On March 3 , 1815 , the U . S . Congress authorized deployment of naval power against Algiers , and two squadrons were assembled and readied for war . The squadron under the command of Commodore William Bainbridge was ported in Boston while Commodore Stephen Decatur ' s squadron was at New York . Decatur ' s squadron was ready to set sail first and departed May 20 , 1815 . It comprised the frigates USS " Guerriere " , the flag ship , with 44 guns , commanded by Captain William Lewis ; " Constellation " , with 36 guns , commanded by Captain Charles Gordon , and " Macedonia " with 38 guns , under the command of Captain Jacob Jones ; the sloops - of - war " Eperyie " , commanded by Captain John Downes , and " Ontario " with 16 guns , commanded by Captain Jesse D . Elliott ; the brigs " Firefly " , " Spark " and " Flambeau " , each with 14 guns , commanded by Lieutenants George W . Kodgers , Thomas Gamble , and John B . Nicholson ; and the schooners " Torch " and " Spitfire " , both with 12 guns , commanded by Lieutenants Wolcott Chauncey and Alexander J . Dallas . Mr . William Shaler . Bainbridge ' s command was still assembling , and did not depart until July 1 , thereby missing the actions . Negotiations . Shortly after departing Gibraltar en route to Algiers , Decatur ' s squadron encountered the Algerian flagship " Meshuda " , and , in a battle off Cape Gata , captured it . Not long afterward , the American squadron likewise off Cape Palos captured the Algerian brig " Estedio " . By the final week of June , the squadron had reached Algiers and had initiated negotiations with the Dey . After persistent demands for recompensation mingled with threats of destruction , the Dey capitulated . By terms of the treaty signed aboard the " Guerriere " in the Bay of Algiers , 3 July 1815 , Decatur agreed to return the captured " Meshuda " and " Estedio " while the Algerians returned all American captives , estimated to be about 10 , and a significant number of European captives were exchanged for about 500 subjects of the Dey along with $ 10 , 000 in payment for seized shipping . The treaty guaranteed no further tributes and granted the United States full shipping rights . Aftermath . In early 1816 , Britain undertook a diplomatic mission , backed by a small squadron of ships of the line to Tunis , Tripoli , and Algiers to convince the Deys to stop their piracy and free the Christian slaves . The Beys of Tunis and Tripoli agreed without any resistance , but the Dey of Algiers was more recalcitrant and the negotiations were stormy . The leader of the diplomatic mission Edward Pellew , 1st Viscount Exmouth , believed that he had managed to negotiate a treaty to stop the slavery of Christians and returned to England . However , due to confused orders , Algerian troops massacred 200 Corsican , Sicilian and Sardinian fishermen who were under British protection just after the treaty was signed . This caused outrage in Britain and Europe and Exmouth ' s negotiations were seen as a failure . As a result , Exmouth was ordered to sea again to complete the job and punish the Algerians . He gathered a squadron of five ships of the line , reinforced by a number of frigates , later reinforced by a flotilla of six Dutch ships . On 27 August 1816 , following a round of failed negotiations , the fleet delivered a punishing nine - hour bombardment of Algiers . The attack immobilized many of the Dey ' s corsairs and shore batteries , forcing him to accept a peace offer of the same terms as he had rejected the day before . Exmouth warned that if they were not accepted he would continue the action . The Dey accepted the terms falling for Exmouth ' s bluff ; his fleet had already spent all its ammunition . A treaty was signed on September 24 , 1816 . 1 , 083 Christian slaves and the British Consul were freed and the U . S . ransom money repaid . After the First Barbary War , the European nations had been engaged in warfare with one another ( and the U . S . with the British ) . However , in the years immediately following the Second Barbary War , there was no general European war . This allowed the Europeans to build up their resources and challenge Barbary power in the Mediterranean without distraction . Over the following century , Algiers and Tunis became colonies of France in 1830 and 1881 respectively , while Tripoli returned to the control of the Ottoman Empire in 1835 . In 1911 , taking advantage of the power vacuum left by the fading Ottoman Empire , Italy assumed control of Tripoli . Europeans remained in control of the government in eastern North Africa until the mid - 20th century . By then the iron - clad warships of the late 19th century and dreadnought s of the early 20th century ensured European dominance of the Mediterranean sea .