Tunisian–Algerian war (1807)
The Tunisian-Algerian war of 1807 was a conflict between the Beylik of Tunis and the Deylik of Algiers. The war led to the emancipation of Tunisia from any sort of Algerian influence, and the ending of the tribute paid by Tunisia to Algeria since 1756. Background 
The war has a complicated background. In 1756, Algiers invaded Tunis and helped and removed Abu al-Hasan Ali I in favor the previous Bey's son, Muhammad I ar-Rashid. Ali was then taken to Algiers, stripped naked, humiliated, and brutally strangled to death in under 4 years by the victorious Algerians. As part of the agreement, Tunis was from then on forced to pay tribute to Algiers, and Algiers was allowed to influence the Tunisian foreign policy. In the 1790s, led by Hammuda ibn Ali and the reformer Youssef Saheb Ettabaa (Youssef of Tunis) the Beylik of Tunis decided to reinvigorate relations with the Ottoman Empire (who disliked Algiers for its unruly and independent nature) and the Sultanate of Morocco (whom have been at conflict with the Algerians for about 250 years by this point). The Ottoman Sultan of this period, Selim III was very Tunisian friendly, and hoped to weaken the power of Algeria and tip the scale of balance in the region of the Maghreb. This was obviously not liked by the Algerians, whom slowly but surely became more and more hostile to Hammuda. While Algiers was experiencing a period of instability and severe unrest from the Odjak of Algiers, which began heavily influencing the local politics and exerting influence over the Dey, Hammuda heavily reformed the Tunisian army on new, more modern lines, waiting for his time to strike. The War 
In 1807 a letter from the Algerian ruler, Ahmed II came Tunis, demanding more tribute, and for Tunisia to give up any claims on Tabarka and to hand over rule of the region to Algiers. Hammud promptly refused this, and mobilized more than 50,000 troops, mainly consisting of Janissaries, militia troops drawn from Kouloughlis and Arab Tunisians, and tribal cavalry, and appointed Slimane Kahia as the supreme commander of his forces. This declaration of war was supported by Selim III, who while couldn't provide military or economic support, provided diplomatic support to the Tunisians, and also secretly encouraged them to declare war on the first place. The Bey (governor) of eastern Algeria, Hussein ben Salah Bey possessed about 4,000 regular troops at his disposal, and also received 3,000 troops as reinforcements from Algiers, putting his effective strength at about 7,000 troops, consisting of janissaries from the Odjak and hastily mobilized Arab-Berber tribal levy, while also leaving local citizen militia of Constantine as defenders of the city. Well aware of his numerical inferiority compared to the Tunisian forces, he decided to hold the chokepoint at the Mansoura plateau in front of Constantine. Slimane assaulted this position which was vigorously defended by the Algerians, and was only able to capture it after 7 deadly assaults, taking many casualties. While Hussein Bey escaped to Djemila, then Setif waiting for reinforcements, Slimane encamped on the Mansoura plateau, and decided laid siege to Constantine instead of assaulting it, which proved to be a mistake, as the defenders of Constantine received heavy reinforcements from Algiers after 1 month of siege during the night, led by Hussein Bey and the Bachagha of Algiers. Slimane commanded his elite cavalry division, led by Hameida ben Aiad, to assault the Algerians, but through brilliant maneuvering, the Algerians managed to push back the Tunisians. After receiving more volunteer reinforcements from Annaba, Hussein encircled Slimane's army and forced them to retreat hastily, leaving behind all sorts of provisions, small arms, and artillery. The Algerians wasted no time, and Hussein and the Bachagha immediately mobilized their army composed by this point mainly of mobilized Makhzen tribal warriors to enter and raid Tunisian territory. Unbeknownst to them, Youssef Saheb Ettabaa, Tunisian prime minister was encamped at the river Wadi Serrat, near El Kef. Upon meeting the Tunisian forces, the Algerians spread out, which proved to be a fatal mistake. The Tunisians severely overwhelmed camps by bombarding them severely and then attacking them while they were in disarray thanks to the heavy artillery barrage. Seeing the chaos caused by these attacks, the Bachagha and Hussein tried to hold out their positions with their regular professional Spahis and Janissaries, to no avail, as they were soon also pushed back, taking severe casualties, and ending the war. Aftermath 
This decisive victory liberated Tunisia from any Algerian influence, and temporarily put an end to the hostilities until 1810, when a more stable Algeria under Ali IV once again declared war on Tunisia. This defeat led to severe instability in Algiers and Constantine, Hussein Bey was executed for his defeat, and Ahmed II was assassinated in a massive military mutiny led by Ali III ar-Rasul, who was in turn overthrown by the aforementioned Ali IV. References 

Wars involving Algeria
Wars involving Tunisia
Military history of Algeria
Military history of Tunisia
Conflicts in 1807