Ali Pasha was born in 1828 in Gusinje, to landowner Hasan-bey Shabanagaj. The Shabanagaj were from the Gruemiri tribe ("fis") 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 Peja and military school in Istanbul. In 1845 Ali was appointed as "kaymakam" (sub-governor) 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.