War between USA and Algiers, 1815. The war would effectively be ended the following year, but then not by the USA, rather Great Britain and the Netherlands.This was a second war after the First Barbary War, which ended 10 years earlier.The background for the war was the continued attacks from Barbary pirates on US vessels in the Mediterranean Sea, and disagreements as to the level of tribute to be paid to the pirates.

History1807: Despite the treaty signed after the First Barbary War, this year, Algiers returns to taking US ships and seamen hostage.1812: USA wages war against France and United Kingdom, pulling all vessels out of the Mediterranean Sea. USA refused to pay tribute to the Dey of Algiers, who responded by declaring war on the USA.1815 March 3: USA effectively declares war on Algiers, sending 10 war ships on Algiers. USA would take hundreds of prisoners from the port of Algiers, using this to bargain; a technique similar to the one the pirates used.
 June 30: A peace treaty is singed, in which the pirates pay the USA $10,000 in reparation for damages and abstain from attacking US ships. The Dey would would quickly abandon the agreement.1816: A joint British and Dutch navy bombards Algiers for 9 hours. The Dey would sign an agreement to stop pirating and enslaving of Europeans.