Under the last real Ayyubid Sultan, as-Salih, the Mamluk corps was built up to unprecedented size and strength. They were a neat solution to a political problem because as slaves, they did what they were told, but as people with high social status, they were motivated to uphold the political order that privileged them. The Mongols had given some Italians slave-trading rights to Crimea during the quiet years, so a steady stream of Kipchak/Cuman Turks poured out of the Black Sea. Slavers were also selling Circassians, Slavs, Armenians, and Georgians. With supply high, prices had to be low.
Mamluks were typically boys between 8 and 10 when they were purchased, and they were carefully indoctrinated to adopt a Mamluk identity. They forgot their home languages and religions. They learned Arabic and the Koran, while they trained in elite fighting skills. They were given wives and fine homes; they had good lives and high status, just not really full freedom to stop being Mamluks. Their children did not automatically get their status unless they went through the same training, but the Mamluks themselves could rise as high in government as was possible. They were viziers, generals, governors and supervisors.
Sultan as-Salih built a fortress and palace for them on an island in the Nile. This group became known as the River Mamluks, the Bahri. From their origins as a personal bodyguard and house soldiers, they increased to a corps of 10,000, and then again to about 40,000.
Sultan as-Salih died during the Seventh Crusade. His wife Shajaret al-Durr worked with his top Mamluks to conceal his death until his heir, Turanshah, could get there. The commander of the Bahri Mamluks raced to fetch Turanshah from Hasankeyf (Turkey) while another helped Shajaret pantomime the Sultan’s continuing life. Before he died, he had signed a number of blank papers that they could use as proof of life. They told everyone he was just too sick to come out of his tent. Meals were sent in, dirty dishes came out. Signed orders went out (written by Shajaret and another top Mamluk, Aybak).
When Turanshah arrived to lead the troops at al-Mansurah, they could let the cat out of the bag. It looked like Shajaret and the Mamluks had stage-managed a peaceful transition in time of war. But as the Crusaders negotiated for King Louis’ freedom, Turanshah began to offend the Bahri Mamluks by appointing his own commanders, demoting the Mamluks who were already filling those roles. He clashed with Shajaret by demanding that she turn over all jewels his father had given her. Within just a few months, Turanshah was thoroughly hated.
In May 1250, Turanshah gave a feast. At the end of it, the top Mamluks rushed in and murdered him. The Crusaders were very interested in these events; Jean de Joinville left a detailed account of how Turanshah fled to a tower but the Mamluks set it on fire, and so on. In the end, the widowed Queen Shajaret declared herself Sultan.
The Caliph of Baghdad could not accept this regime change, nor could the Ayyubid rulers of cities in Syria. The top Bahri Mamluk commander, Aybak, removed Shajaret from being Sultan but married her, so that she was still in the power loop. Sultan Aybak reigned for seven years.
During this time, Shajaret became more jealous of power. She began taking various matters away from Aybak and quarreling about other wives. At length he married a third wife to make an alliance, and Shajaret paid servants to help murder Aybak in his bath. She claimed that he had just drowned. The other top Mamluks didn’t buy this; they tortured the servants to get confessions. Shajaret was beaten to death and thrown into a moat.
Aybak’s son was briefly made Sultan, but the kind of government that was emerging was not a father-to-son monarchy. One of Aybak’s top Mamluks took over; he may have been a displaced Khwarezmian, sold into slavery by Mongols. He ruled for a few years, then was assassinated by another Mamluk leader, Baibars.
From 1250 until the Ottoman conquest in 1517, the Sultan of Egypt was always the most powerful Mamluk. Sometimes it was a Sultan’s son, but other times, it wasn’t. In a pure monarchy, genetic descent matters most, but in a Mamluk dynasty, it didn’t matter apart from the privilege a Sultan’s son could use to build his own power base. The 10th Mamluk Sultan was actually an Oirat tribe member of the Mongol confederation, captured in a Middle Eastern battle and sold into slavery (the Oirats were the Siberian fur-hunters).
The Mamluk government became the most stable dynasty since the Ptolemies. Mamluks were promoted by merit, so the top Mamluk was always physically strong, intelligent, and socially clever.