Bombardment of Algiers ( 1784 ) The 2nd Bombardment of Algiers took place between 12 and 21 July 1784 . A joint Spanish - Neapolitan - Maltese - Portuguese fleet commanded by the experienced Spanish Admiral Antonio Barceló bombarded the city , which was the main base of the Barbary corsairs , with the aim of forcing them to interrupt their activities . Massive damage and casualties were inflicted to the Algerians , while the loss aboard the allied fleet was low . The Dey of Algiers refused to start negotiations immediately but the fear of a third planned expedition under José de Mazarredo convinced him to negotiate a peace with the Spanish by which he was forced to cease large - scale piracy , signalling the effective end of the Barbary privateering until the outbreak of the Napoleonic Wars . Background . In August 1783 , as punishment for the acts of piracy undertaken by the city , a Spanish fleet with Maltese participation under Antonio Barceló bombarded Algiers for 8 days . The success of the attack , achieved at the cost of less than 50 casualties , caused joy in Spain and encouraged the Regency of Tripoli to make peace with Spain . Despite the heavy damage suffered , the Algerians did not surrender . Five Algerian privateers captured two Spanish merchant vessels near Palamós in September 1783 as a gesture of defiance . The city ' s defenses were reinforced with a new 50 - gun fortress , 4 , 000 Turkish volunteer soldiers were recruited in Anatolia , and European advisors were hired to assist in the building fortifications and batteries . In addition , at least 70 vessels were prepared to repel the Spanish , and a reward of one thousand gold pieces was offered by the Dey to anyone who captured a ship of the attacking fleet . Meanwhile , in Cartagena , Barceló had finished preparations for a new expedition . His fleet consisted of four 80 - gun ships of line , four frigates , 12 xebec s , 3 brig s , 9 small vessels , and an attacking force of 24 gunboat s armed with pieces of 24 pounds , 8 more with 18 pounds ' pieces , 7 lightly armed to board the Algerian vessels , 24 armed with mortars , and 8 bomb vessel s with 8 pound pieces . The expedition was financed by Pope Pius VI and supported by the Navy of the Kingdom of the Two Sicilies , which provided two ships of the line , three frigates , two brigs and two xebecs under Admiral Bologna , by the Order of Malta , which provided a ship of line , two frigates and five galley s , and by that of Portugal , which provided two ships of line and two frigates under Admiral Ramirez Esquivel . These last joined the allied fleet later and actually arrived in middle of the bombardment . Bombardment . On 28 June , having entrusted itself to the Virgen del Carmen , the Allied fleet sailed from Cartagena , arriving off Algiers on 10 July . Two days later at 8 : 30 AM , the bombardment began with the Spanish ships opening fire . It was kept up until 4 : 20 PM , during which timb about 600 bombs , 1 , 440 cannon ball s and 260 shells were fired over the city , compared to 202 bombs and 1 , 164 cannon balls fired by the Algerians . Major damage to the city and its fortifications and a large fire were observed . An attack by light vessels of the Algerian fleet , composed of 67 ships , was repulsed , four of them being destroyed . The Allied casualties were minimal : 6 killed and 9 wounded , most of them due to accidents with the fuses of the bombs . Gunboat No . 27 , commanded by the Neapolitan ensign José Rodríguez , exploded accidentally , killing 25 sailors . In the following eight days , seven additional attacks were ordered . The Algerians had placed a line of barges armed with artillery that largely prevented the Allied gunboats getting close to their objectives . A shot fired from the fortifications hit the felucca from which Barceló were directing the bombing , sinking it . José Lorenzo de Goicoechea came to the aid of the admiral , who was rescued unscathed . Passing immediately to another boat , Barceló continued leading the attack , downplaying the importance of the incident . Finally , on 21 July , it was decided to end the attack . Contrary winds forced Barceló to give the order to return back to Cartagena . More than 20 , 000 cannon balls and grenades had been fired on the enemy , causing severe damage to the fortifications and the city , and sinking or destroying most of the Algerian vessels . The Allied casualties were 53 men killed and 64 wounded , most of them due to accidents . Aftermath . The Dey of Algiers , under threat of a new expedition that was already being prepared by Barceló , who had promised attack Algiers every year until he accepted his conditions , agreed to open negotiations with Spain . These culminated in a treaty which was signed on 14 June 1786 by the Dey himself and José de Mazarredo , who came to Algiers in command of a squadron of two ships of the line and two frigates . Tunisia also preferred to reach an agreement with Spain . As far as these nations were concerned , Barbary piracy and the Barbary Slave Trade in the Mediterranean was ended . However , some years later the problem returned due to the turmoil caused by the Napoleonic Wars .