After the French withdrew in 1801, control of Egypt was nominally restored to the Ottoman Empire, but in fact was disputed between the old Mamluk elite, Egyptian Arab nobles, and the Ottomans.
Makram allied with Muhammad Ali, the commander of Albanian troops within the army sent by the Empire to restore control.
In May 1805, Egyptians led by Makram forced the Ottomans to replace the WāliAhmad Khurshid Pasha with Muhammad Ali. Makram soon discovered that Muhammad Ali planned to rule Egypt himself. Makram objected to a foreign ruler. Muhammad Ali exiled Makram to Damietta on 9 August 1809, where he stayed for four years. Makram then moved to Tanta, where he died in 1822.