However, upon the French defeat and departure, Muhammad Ali seized control of the country and declared himself ruler of Egypt, quickly consolidating an independent local powerbase.
After repeated failed attempts to remove and kill him, in 1805, the Sublime Porte officially recognized Muhammad Ali as Pasha and Wāli (Governor) of Egypt.
In May 1879, the United Kingdom and France began pressuring the Ottoman Sultan Abdülhamid II to depose Ismail Pasha, and this was done on June 26, 1879.
Ismail Pasha left Egypt and initially went into exile to Naples, but was eventually permitted by Sultan Abdülhamid II to retire to his Palace of Emirgan[3] on the Bosphorus in Constantinople.
During this period, the Muhammad Ali Dynasty under Tewfik Pasha and his son Abbas II continued to rule Egypt and Sudan using the title Khedive, whilst still under nominal (de jure) Ottoman sovereignty until 1914.