After the French withdrawal from Egypt during the Napoleonic Wars an Ottoman-Albanian officer, Muhammad Ali seized control of Egypt through a three-way civil war, establishing himself as Wāli between 1805 and 1848. During his reign he let European contractors and managers enter the country, establishing a cordial relationship with the French. However, under his grandson, Abbas I (1848-1854) foreign policy was turned on its head, as Abbas turned to France's British rivals in order to fight the Ottomans.