The French-Algerian War of 1681–1688 was part of a wider campaign by France against the Barbary Pirates in the 1680s.

Background
In October 1680, Barbary pirates captured a number of French vessels, without declaration of war, and took the captains and crews to Algiers as slaves. On 18 October the Dey of Algiers, Baba-Hassan, officially declared war on Louis XIV and on 23 October, he announced the commencement to hostilities to the French consul, Jean Le Vacher. At the same time, he also ordered twelve warships to sea.  Learning of this, Louis XIV ordered his ministers to prepare a punitive expedition.

Bombardment of Algiers (1682)

The outcome of the operation is difficult to assess. Around 500 Algerians were killed, and fifty buildings demolished. The French fleet succeeded in inflicting serious damage on the port and city of Algiers, without suffering any major losses itself, and it forced the Dey to sue for peace. However Duquesne's mission had been to secure Dey's complete submission, which time and the weather had not permitted. When Louis XIV learned on 11 October that the mission had not achieved its aim, he made his displeasure clear. He nevertheless realised the overwhelming effect that relatively few bombs - some 280 - had had on the city.  During the French bombardments which followed, in 1683, 1684 and 1688, Duquesne and then Tourville, would force the Dey to free all the Christians he held in slavery, but they did not succeed in ending the corsair war waged by the Regency of Algiers against European merchant vessels in the Mediterranean.

The Jews of Marseilles were suspected of passing warnings to their co-religionists in Algiers about the impending French assault, and this led to their being temporarily expelled from the city.

The next year, Duquesne sailed again to bombard Algiers for the second time.

Bombardment of Algiers (1683)

The bombardment began on the night of 26–27 June, and two hundred and twenty two bombs, launched in less than twenty four hours, started fires in Algiers and prompted general disorder as well as killing around 300 Algerians. Hassan Dey intended to resist nonetheless, but the population urged him to sue for peace. Duquesne agreed to a truce on condition that all Christian slaves were delivered to him.  When the truce expired, Hassan Dey asked for, and received, an extension.  Duquesne meanwhile set out his terms for agreeing a peace:
 freeing all Christian slaves
 an indemnity equal to the value of all the goods seized from France by pirates
 a solemn embassy to be sent to Louis XIV to ask his forgiveness for the hostile acts committed against his navy.

These terms resolved the Dey to continue resistance.

One of the Algerian commanders, Mezzo Morto Hüseyin Pasha, then seized command and denounced the cowardice of the Dey, for agreeing to treat with the French. He had him put to death and was acclaimed as his successor by the janissaries. Before long a red flag, raised from the heights of the Casbah, announced to Duquesne that combat was resumed.  The Algerians replied to the bombs hurled at their city by tying the French consul, Jean Le Vacher, to the mouth of a cannon. On 28 July pieces of his shattered limbs fell on the decks of the French vessels, along with those of other French prisoners blown to pieces.

Despite the fierce resistance of the Algerians, the city was engulfed by an enormous fire which consumed palaces, mosques, and many other buildings across the city; the wounded could not find any refuge; and ammunition ran low. Algiers would have been reduced to ruins had not Duquesne himself run out of  missiles. The bombardment ended on 29 July.

The pride of the Algerian pirates was crushed, and as the French fleet returned to France, Algiers sent an embassy under Djiafar-Aga-Effendi to ask forgiveness of Louis XIV, for the injuries and cruelty that the corsairs had inflicted on France.

The new Dey, Mezzo Morto Hüseyin Pasha agreed to free another 546 captives, but refused to sign a peace agreement with Duquesne, who was then 79 years of age, so Louis XIV sent another envoy, Anne Hilarion de Tourville, to treat with him. A hundred-year peace was agreed, including a provision to leave the coasts of France unmolested. Five years later, after Algiers violated the treaty, the French again bombarded the city. Admiral d'Estrées obliged the Dey to seek a new peace agreement, signed on 27 September 1688, which the Algerians respected. Thereafter the corsair captains, though they avoided the coasts of France, continued their raids elsewhere, causing considerable damage to the coastal regions of Spain.

Bombardment of Algiers (1688)

In 1688 a military expedition was ordered by Louis XIV against the Regency of Algiers in order to enforce the peace treaty of 1683 which had been violated by Algerian pirates.  The squadron, comprising 31 ships and 10 bomb galiots, was commanded by Jean II d'Estrées.

D'Estrées' squadron arrived at Algiers on 26 June. It succeeded in inflicting serious damage on the city, but its artillery defences had been strengthened since the previous French expeditions in 1682 and 1683. As a result, the French fleet lost several ships and was obliged to retire after 16 days. Mezzo Morto retaliated by attackin the French coast and shipping.

Aftermath
By the end of 1688, the Dey felt so strong that he did not allow a delegate from Istanbul to land in Algiers. This show of force prompted the janissaries who were fearing for their influence to deposit him and choose Hadj-Chabane as his successor. Relations with France, which were restored in 1688, improved, especially after Dey Mohammed-el-Amine sent an ambassador to France. On 24 September 1689, a treaty was signed in Algiers.

References

17th century in Algiers
Janissaries
Barbary pirates
Wars involving Algeria
Wars involving France
Conflicts in 1681