Mamluks, also spelled Mamelukes, purchased slaves converted to Islam who advanced themselves to high military posts in Egypt. From this class sprang two ruling dynasties, the Bahri (1250-1382), made up of Turks and Mongols, and the Burji (1382-1517), made up of Circassians; both were named for places where the troops who seized power had been quartered. The founding of the Bahri dynasty in 1250 began a succession that brought territorial gains and great prosperity to Egypt.
After 1341 the power of the Bahri sultan passed gradually to troop commanders, and by 1381 the first Burji ruler was able to take over the throne. His rule and that of his successors was troubled by palace revolts, civil wars, and foreign conquests, culminating in the defeat of Egypt in 1517 by Selim I, sultan of the Ottoman Empire. Egypt was then subject to the
authority of an Ottoman representative, the pasha, but actual power remained in the hands of Mamluk beys, or governors of districts or minor provinces. When Napoleon Bonaparte, seeking to expand French power in the Mediterranean, invaded Egypt, he defeated the Mamluks in the Battle of the Pyramids on July 21, 1798. After the French evacuated Egypt, the Mamluks struggled with the Ottomans for power but were completely routed; the massacres at Cairo in 1805 and 1811 destroyed the power of the Mamluks. The survivors fled to Nubia.