After the fall of Saladin’s Ayyubid dynasty in the thirteenth century, the Mamluk Sultanate became the masters of Egypt. The Mamluks were overthrown by the Ottomans in the Ottoman–Mamluk war of 1516 and 1517. But after the war, the Ottomans retained the Mamluks as an Egyptian ruling class. The Mamluks were allowed to retain their influence in Egypt though they remained the vassals of the Ottomans.
When Napoleon attacked Egypt in 1798, the country was out of direct control of the Ottomans and was being dominated by the local Mamluk elite. In the Battle of the Pyramids, fought on 21 July 1798, Napoleon’s French forces decisively defeated the Mamluk cavalry. The battle was over in an hour, with the French suffering just 300 casualties while inflicting more than 6000 casualties on the Mamluk cavalry. The Mamluk power in Egypt was finished. The Mamluk survivors moved into Syria, leaving Egypt in the hands of Napoleon who, three days later, triumphantly marched his troops into Cairo.
With his quick victory in Egypt, Napoleon had created the impression in Western Europe that he would achieve what all the crusades of the past had failed to achieve. But ten days later, the British Rear-Admiral Sir Horatio Nelson shattered Napoleon’s dream of founding a French Empire in the Levant. In the Battle of the Nile, between 1st and 3rd of August 1798, Nelson obliterated Napoleon’s navy at Aboukir Bay on the Mediterranean coast off the Nile Delta of Egypt. With most of his ships destroyed, Napoleon was now cut off from France and basically stuck in Egypt with his 35,000 troops. He remained in Cairo for three years, till 1801.
Napoleon’s three year stay in Cairo wrought profound, long-term consequences for Egypt. He had not arrived in Egypt to merely conquer and loot—he believed that it was his destiny to liberate, reform, and bring modern ideas to the backward nations of the world. He had brought with him a team of more than 160 scholars. In three years, he gave Egypt the kind of reforms that this country had not seen for several centuries. He turned the traditional Egyptian society on its head.
Egypt got a postal service. In Cairo and other urban areas street lighting and sanitation was created. A modern mint was established. A French trading company came up. There was creation of plague hospitals, and printing presses with typescript for French, Greek, and Arabic. Slavery was abolished. The dhimmi system was abolished, and the Ottoman and Mamluk social hierarchy came to an end. Though the Egyptian elite remained unconvinced of Napoleon’s intentions, many of his tectonic reforms worked so well that they were not abolished after he left the country.
It can be argued that Napoleon led to the rise of Egyptian nationalism through his support of Egyptian scholarship. He encouraged the study of Egyptian culture before the time of the Mamluk Sultanate and the Ottoman Empire. He funded several scholarly works on ancient Egypt. This led to the rise of the new discipline of Egyptology. In July 1799, a young engineering officer, Pierre-François-Xavier Bouchard, who had arrived in Egypt with Napoleon, discovered the Rosetta Stone, which played a significant role in the deciphering of ancient Egyptian language.