This part of the Ottoman dominions experienced direct European military might when Napoleon invaded it in 1798, utterly defeating local Mamluq forces at the Battle of the Pyramids. British sea power prevented him from receiving any reinforcements from France, thus bringing his campaign to a halt. Napoleon himself secretly left his army in Egypt in 1799, and a British army finally reconquered the country for the Ottomans in 1801.
A Turkish general, Muhammed Ali, was sent to Egypt to restore order, and he was soon acting as a semi-independent ruler. He set about modernizing the country, but seeing that nothing could be done while the Mamluqs retained their power, he massacred them. He built hundreds of schools, modernized the administration, and introduced printing into the country (as a government monopoly). He raised a western-style army, recruited from the peasantry, and then set about conquering a huge empire in the Sudan.
In 1821 he helped the sultan put down a rebellion in Greece. This confirmed his de facto independence from Constantinople, and in 1833 he demanded, and, due to British and French pressure, gained Syria from the sultan as payment for his part in the war of Greek independence. A little while later he started marching on Constantinople itself, with a view to replacing the Ottoman regime with one of his own.
ORIGINAL SOURCE: timemaps.com