The armies of Napoleon Bonaparte defeated the Mameluke army at Imbabah and Shubra Khit; took Alexandria; and occupied Cairo. In fact, Napoleon wanted to strike a blow to the British Empire, with which France was at war in order to gain control over land and sea routes to the British colony of India. Within a month of entering Egypt, the British navy, under Admiral Nelson, attacked and destroyed the French fleet at Abu Qir Bay in Alexandria.
The Ottoman Sultan Selim III sent an army that, although it was defeated by the French, made it clear they were not in Egypt with the complicity of Constantinople. The people of Cairo rioted against the French. Centered on Al Azhar mosque and led by the 'ulama' (high respected religious figures), the rebellion had a religious as well as a national character. During this period, the populace began to regard the ulama not only as moral but also as political leaders. By that time, the French general Dupuy was killed. Bonaparte and General Jean Baptiste Kléber quickly suppressed this rising; but the stabling of the French cavalry in the mosque of Al-Azhar gave great and permanent offence. In 1799, Napoleon succeeded in invading Syria but failed in taking Acre (in Palestine) and his forces retreated. During Bonaparte's absence from Egypt, Murad Bey and Ibrahim Bey made an attempt to attack Cairo, but he arrived in time and inflicted a crushing defeat on the Turkish army that had landed at Abu Qir, aided by the British fleet that was commanded by Sir Sidney Smith.
Few months later, Napoleon, with a very small company, secretly left Egypt to France, leaving his troops behind and General Jean-Baptiste Kléber as his successor. General Kléber was assassinated, leaving the army to General Menou, who claimed to have converted to Islam and declared Egypt a French protectorate. The occupation was finally terminated by an Anglo-Ottoman invasion force. The French forces in Cairo surrendered on June 18, 1801, and Menou himself surrendered at Alexandria on September 3. By the end of September, the last French forces had left the country.
Napoleon's invasion revealed the Middle East as an area of immense strategic importance to the European powers, thus inaugurating the Anglo-French rivalry for influence in the region and bringing the British into the Mediterranean. Napoleon established a style of the French government. He implemented public works projects to clean up and renovate the long-neglected country, clearing blocked canals, cleaning the streets and building bridges. He also introduced new crops and a new system of weights and measures. The task of the 167 scholars, scientists and artists who accompanied him was to investigate every aspect of life in ancient and contemporary Egypt. The publication of "Description de l'Egypte" in 24 volumes became the foundation of modern research into the history, society, and economics of Egypt.