The Mamluks were originally slave boys of the Abbasid caliphs of the Islamic Empire (the word "mamluk" just means "slave"). Starting around 850 AD, the Abbasid caliphs captured or bought young boys who were not Muslims as slaves and brought them up to be Sunni Muslim soldiers in a slave army. These men made a great army and there soon got to be more and more Mamluks.
In 1144, the Mamluk general Imad-ud-Din Zangi conquered Edessa, one of the Crusader states founded after the First Crusade. Zangi's own slaves killed him shortly after that, when he caught them drinking his wine. When the Second Crusade arrived to win Edessa back, Zangi's son Nureddin fought them off successfully, and after the Second Crusade ended without taking any of his territory, Nureddin created a kingdom for himself by conquering Damascus from local Muslim rulers.
During the 1100s AD, other Mamluks worked for the Ayyubid sultans in Egypt and Syria, but little by little the sultans had less power and the Mamluks got more and more power. In 1244, the Mamluks conquered Jerusalem from the Crusaders, and in 1245 Louis IX of France led the 7th Crusade to try to get it back, but the Mamluks captured him. In 1250 AD Shajar al-Durr, the mother of the last Ayyubid sultan, killed her son and ruled on her own, minting coins and signing decrees. She negotiated to end the 7th Crusade and let Louis go. Shajar al-Durr soon had to marry the leader of the Mamluks, Aybak, in order to keep power, but she continued to rule and in 1257 she had Aybak killed. After this, though, al-Durr herself was arrested and then killed, and the Mamluks got control of Egypt and Syria.
When the Mongols invaded Syria in 1260 AD, the Bahri Mamluks defeated them at Ain Jalut and pushed the Mongols back to Persia. It was the first time anyone had defeated the Mongols in a big battle, and it prevented the Mongols from adding the Romanized half of the Islamic Empire to their Mongol Empire. The man who led the Mamluks, Baybars, became sultan after the battle.
Mosque of Baybars in Cairo
Baybars and the Bahri Mamluks defeated the last of the Crusaders in 1263. The Mamluks really hated the Crusaders, because the Crusaders had made an alliance with the Mongol Khan Mongke against Islam. There was a big battle at Antioch, and in the end the Mamluks killed 16,000 Christian soldiers and sold all of the hundred thousand people living in Antioch as slaves. (Compare this to Alexander at Tyre, or the Athenian massacre at Melos)
From 1293 to 1340, the sultan al-Nasir enjoyed an unusually long reign of 47 years! The Mamluks were very powerful, and his court was very rich with gold and all kinds of luxuries. But this long period of peace and wealth ended just after al-Nasir's death when the Black Death, or bubonic plague, came to Cairo in 1347 AD and killed many of the people who lived there.
After 1382 AD, another group of Mamluks took charge. These sultans were called the Burjis, and they were mainly Circassians from southern Russia. There was less peace and more fighting among the Burjis. But they were still very good soldiers against other people too. In 1426 AD, for instance, the Mamluks conquered the island of Cyprus, where Europeans had been growing sugar with the work of African slaves. In 1440, the Mamluks attacked Rhodes, but they could not take it. By 1517, however, the Ottomans defeated the Mamluks and took over their empire.