Tunisian–Algerian War (1705)

The Tunisian–Algerian War of 1705 was a conflict between the Regency of Algiers and the Regency of Tunis.

Background
During the Maghrebi war, The Regency suffered from brutal campaigns from both the West and East by the Moroccan and Tunisian alliance. The Dey of Algiers Hadj Hassen-Chaouch who was in charge during the rest of the war, was mainly helped by his Agha Hadj Mustapha (fr), an important figure in the Maghrebi War. His first battles took place in the Western Beylik during the Mascara Campaign from the Moroccan army of Moulay Ismail who had started pillaging all of the western cities of the beylik of oran. In 1701, Hadj Mustapha helped his vassal Ali Khodja Bey in Constantine, who then died trying to defend Constantine from the army of Ibrahim el Sharif. Mustapha would then meet the Tunisians near Setif and win the Battle of Jouami' al-Ulama with few casualties. The war ended with the assassination of Murad III and his entire family by Ibrahim el Sharif, who had more specific plans after his return from Istanbul.

The war
After the Maghrebi war, the Dey Hadj Chaouch resigned from being Dey and appointed Hadj Moustapha for his numerous victories during the war. The regency, however, suffered from a lack of money due to the war. Consequently, The Dey would unnecessarily raise taxes trying to raise some money for the already crumbling state, But even with all that, The only beneficial way to gain money, Was to turn towards the neighboring state of Tunis.

Battle of Kef
The Algerian army entered the Tunisian territory on July 8 th and set their camps close to Kef in Oued el-Tin (Probably Oued-Mellègue). Unfortunately for the Tunisians, When the Algerians set their camps, One of the Banu Hilal Arab tribes of Tunisia named Ouled Saïd (fr) Decided to switch sides and ally with the Algerians, This event would eventually lead to other various other arab tribes to follow the Ouled said. And eventually the powerfull Drid's (fr) who had already betrayed Tunisia several times before. A part of Ibrahim's regular troops also changed sides. The Dey Mustapha then proceeded to send officers to Ibrahim to ask peace terms, such as: demanding Tunisia pay a tribute for war reparations, send a delivery of 1000 camels, and hand over one of his children to the Dey to serve as a hostage.

Ibrahim took this as a provocation, And entered Kef soon after with his Agha Al-Husayn I ibn Ali. Even tho Ibrahim had the advantage in the battlefield from. The Algerians would somehow take the advantage on them and surround the city, leaving the tunisians trapped and worried to be attacked from all sides. After a long fighting, Ibrahim would eventually surrender with the small amount of soldiers he had. Getting imprisoned and sent to Algiers. After this, the rest of the Tunisian troops retreated to Tunis in the head of their Agha. The most influential one of them, Al-Husayn I ibn Ali, proclaimed himself Dey and founded the Husainid dynasty on 10 July, 1705. Putting an end to the Muradid War of Succession.

Siege of Tunis
The Algerian army eventually arrived in front of Tunis and put it under siege. The Tunisians, fearing the pillage of their city, resisted and protested against the Dey Moustapha, causing Husayn to pay Hadj Moustapha a ransom of 150,000 Piastres to lift the siege. The Dey then noted that food and ammunition were becoming increasingly short and that winter was approaching, leaving Mustapha no choice but to abandon the siege and go back to Algiers.

Aftermath
Mustapha left Tunis on October 6, 1705, and was harassed by Kabyles and Tunisians on his way to Algiers. After finally returning to Algiers, he received his payment from Husayn.

After the assassination of the Hadj Mustapha, Several Pretenders fought for the title of Dey and Algiers fell into chaos with the assassinations of the succeeding deys, two people started fighting for the title of Dey. The first one was a representative of the Ottoman Sultan Ahmed III and the other one was described as the chosen one of the Algerians. Finally, after five years of political and economic instability, Baba Ali Chaouch became Dey and restored stability to the republic.