Following the French invasion of Egypt in 1798 and Napoleon's defeat of Egyptian forces, which consisted largely of the ruling Mamlukmilitary caste, the Ottoman Empire dispatched troops from Rumelia under the command of Muhammad AliPasha to restore the Empire's authority in what had hitherto been an Ottoman province. 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 SublimePorte officially recognized Muhammad Ali as Pasha and Wāli of Egypt. However, demonstrating his grander ambitions, he claimed for himself the higher title of Khedive, as did his successors, Abbas I, Sa'id I and Ibrahim Pasha.
Khedivate (1867–1914)
The Muhammad Ali dynasty’s use of the title Khedive was not sanctioned by the Ottoman Empire until 1867 when Sultan Abdülaziz officially recognized it as the title of Ismail Pasha. Moreover, the Porte accepted Ismail's alteration of the royal line of successionto go from father to son, rather than brother to brother, as was the tradition in the Ottoman Empire, and Arab dynasties. In May 1879, the British Empire and France began pressuring the Ottoman SultanAbdülhamid II to depose Ismail Pasha, and this was done on June 26, 1879. The more pliable Tewfik Pasha, Ismail's son, was made his successor as the new Khedive. 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 on the Bosphorus in Istanbul. There he remained, more or less a state prisoner, until his death. He was later buried in Cairo. After the nationalist Urabi Revolt of 1882, Britain invaded Egypt in support of Tewfik Pasha, and would continue to occupy and dominate the country for decades. During this period, the Muhammad Ali Dynasty under Tewfik Pasha and his son Abbas Hilmi Pasha continued to rule Egypt and Sudan using the title Khedive, whilst still under nominal Ottoman sovereignty until 1914. Abbas Hilmi Pasha was deposed by the British in 1914, and Egypt was declared a protectorate of Britain, the Sultanate of Egypt, which was ruled by Abbas's uncle Hussein Kamel under the title of Sultan.