Ali Pasha was born in 1828 in Gusinje, to landowner Hasan-bey Shabanagaj. The Shabanagaj were from the Gruemiri tribe and were related via marriage with the Bushati family of Shkodra. Shaban Aga, their eponymous ancestor was the son-in-law of Sulejman Pasha Bushati, sanjakbey of Shkodra. He was sent in Gusinje as the commander of the fortress around 1690. The Shabanagaj family owned large estates in Berane. He finished Turkish-language school in medresa in Peć and military school in Istanbul. In 1845 Ali was appointed as kaymakam of Gusinje, succeeding his father on this position. In the 1860s he supported the uprising of northern Albanian Muslim tribes against Tanzimat reforms which reduced their privileged status. The League of Prizren was established with Ottoman support in 1878, after the Congress of Berlin decided to cede the towns of Plav and Gusinje, which were notably Muslim Albanian-inhabited, to the Principality of Montenegro. Ali Pasha, whose lands were part of the proposed cessations to Montenegro hosted a gathering of local Albanian leaders and mobilized Albanians of the area into a military force to resist and prevent territorial losses. He became one of League's founders and military commanders in the region of Plav and Gusinje. He was one of the commanders of irregulars mobilized by the League having assembled some 10,000-20,000 Albanian men and defeated Montenegrin troops in the Battle of Novšiće with his forces bringing back some sixty heads to Gusinje. He later used his forces against the Ottoman Empire. In the early phases of the attack against Mehmed Ali Pasha he commanded the volunteer troops that blocked the routes from Đakovica to the Ottoman-Montenegrin border. He was also the leader of the Albanian troops of the League of Prizren against the Principality of Montenegro at the Battle of Novšiće. After the irregulars of the League of Prizren were crushed by the Ottomans in 1881, Ali Pasha of Gusinje was arrested. He was released after the Sultan gave general amnesty. Ali Pasha was appointed to the position of mutesarrif of the Ottoman Sanjak of İpek because he did not object the Ottoman rule and maintained a close connection with the Porte throughout the conflict being more concerned to prevent Montenegro to capture Plav and Gusinje. The Ottoman state also gave him forestland for his defense of Gusinje against the Montenegrins and later Ali Pasha sent some Albanian youths from the region for training and service in the place guard of sultan Abdulhamid II. In 1881, during his visit to Istanbul, he was promoted to the rank of beylerbey.
The exploits of Ali Pasha of Gusinje presented material for myth making and in the Albanian national epic poem Lahuta e Malcis he is presented as a blazing hero and is the central figure of the 8thcanto and one of the important figures of the 9th canto.