Second Barbary War

The Second Barbary War (1815) or the U.S.–Algerian War was fought between the United States and the North African Barbary Coast states of Tripoli, Tunis, and Algiers. The war ended when the United States Senate ratified Commodore Stephen Decatur’s Algerian treaty on December 5, 1815. However, Dey Omar Agha of Algeria repudiated the US treaty, refused to accept the terms of peace that had been ratified by the Congress of Vienna, and threatened the lives of all Christian inhabitants of Algiers. William Shaler was the US commissioner in Algiers who had negotiated alongside Decatur, but he fled aboard British vessels during the Bombardment of Algiers (1816). He negotiated a new treaty in 1816 which was not ratified by the Senate until February 11, 1822, because of an oversight.
After the end of the war, the United States and European nations stopped paying tribute to the pirate states; this marked the beginning of the end of piracy in that region, which had been rampant in the days of Ottoman domination during the 16th–18th centuries. The western nations built ever more sophisticated and expensive ships which the Barbary pirates could not match in numbers or technology.
Background.
The First Barbary War (1801–05) had led to an uneasy truce between the US and the Barbary states, but American attention turned to Britain and the War of 1812. At the prompting of Britain, the Barbary pirates returned to their practice of attacking American merchant vessels in the Mediterranean Sea and ransoming their crews to the United States government. At the same time, the major European powers were still involved in the Napoleonic Wars, which did not fully end until 1815.
At the conclusion of the War of 1812, however, the United States returned to the problem of Barbary piracy. On 3 March 1815, Congress authorized deployment of naval power against Algiers, and the squadron under the command of Commodore Stephen Decatur set sail on 20 May. It consisted of (flagship), , "Macedonia", , , , , "Flambeau", , and .
War.
Shortly after departing Gibraltar en route to Algiers, Decatur's squadron encountered the Algerian flagship "Meshuda" and captured it in the Battle off Cape Gata, and they captured the Algerian brig "Estedio" in the Battle off Cape Palos. By the final week of June, the squadron had reached Algiers and had initiated negotiations with the Dey. The United States made persistent demands for compensation, mingled with threats of destruction, and the Dey capitulated. He signed a treaty aboard the "Guerriere" in the Bay of Algiers on 3 July 1815, in which Decatur agreed to return the captured "Meshuda" and "Estedio." The Algerians returned all American captives, estimated to be about 10, in exchange for about 500 subjects of the Dey. Algeria also paid $10,000 for seized shipping. The treaty guaranteed no further tributes by the United States and granted the United States full shipping rights in the Mediterranean Sea.
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 enslaved European Christians. The Beys of Tunis and Tripoli agreed without any resistance, but the Dey of Algiers was less cooperative, and the negotiations were stormy. The leader of the diplomatic mission, Edward Pellew, believed that he had negotiated a treaty to stop the slavery of Christians and returned to England. However, just after the treaty was signed, Algerian troops massacred 200 Corsican, Sicilian and Sardinian fishermen who had been under British protection thanks to the negotiation. This caused outrage in Britain and Europe, and Pellew's negotiations were seen as a failure.
As a result, Pellew 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 that he had rejected the day before. Pellew warned that if the terms were not accepted, he would continue the action. The Dey accepted the terms, but Pellew had been bluffing since his fleet had already spent all its ammunition.
A treaty was signed on 24 September 1816. The British Consul and 1,083 other Christian slaves 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, which allowed the Europeans to build up their resources and challenge Barbary power in the Mediterranean without distraction. Algiers and Tunis were seized and colonized by France in 1830 and 1881, respectively.