Siege of Tunis (1705)

His agha and Khaznadar , Al Husayn I ibn Ali, decided to retreat and go back to Tunis, where he would proclaim himself Bey, and by the Tunisian divan and founder of a new dynasty, the Husainids.

[1][2] The Bey, despite his useless attempts against the Dey, he would always refuse the peace treaties proposed by the Algerians, while the population of Tunis protested for peace even though with what happened in Kef and Tébourba, Husayn would finally pay the Dey a ransom of 150,000 piastres in exchange for peace and the evacuation of Tunisian territory, but Moustapha would eventually leave after he noted the coming of the bad season and multiple Arabs that were on his side deserted as there was no more to pillage, The Dey would eventually leave in the night of 9 October, leaving behind him the majority of his treasures and military equipment sent by the governor of Bône.

[3] For the Algerians, a small cavalry was sent by Husayn to harras them on their way back to Algiers, they would meet in the plain of Sedira near the city of Majaz al-Bab, but would be quickly defeated suffering 500 losses, even tho the Dey won this battle again, he would suffer from another revolt in Algiers, leaving Hussein Khodja as his new successor.

For the Tunisians, peace wouldn't be achieved as another political dispute erupted between the Bey Husayn and his Dey Mohamed Khodja, as he was a brave participant during the siege against the Algerians.

He would eventually die after a revolution erupted in Tunis in favor of Husayn, he was meant to meet Ibrahim in Porto Farina but would suffer the same treatment as Mohamed,[4][5] he was buried beside one of the town's forts.