Turkish children who had been kidnapped or bought as slaves from the Barbary coasts. The Egyptians assimilated and trained the boys and young men to become Islamic soldiers who served the Muslim caliphs and the Ayyubid sultans during the Middle Ages . The first mamluks served the Abbasid caliphs in 9th century Baghdad . Over time they became a powerful military caste . On more than one occasion, they seized power, for example, ruling Egypt from 1250–1517. From 1250 Egypt had been ruled by the Bahri dynasty of Kipchak origin. Slaves from the Caucasus served in the army and formed an elite corp of troops. They eventually revolted in Egypt to form the Burgi dynasty . The Mamluks' excellent fighting abilities, massed Islamic armies, and overwhelming numbers succeeded in overcoming the Christian Crusader fortresses in the Holy Land. The Mamluks were the most successful defense against the Mongol Ilkhanate of Persia and Iraq from entering Egypt. [ 14 ] On the western coast of Africa, Berber Muslims captured non-Muslims to put to work as laborers. They generally converted the younger people to Islam and many became quite assimilated. In Morocco, the Berber looked south rather than north. The Moroccan Sultan Moulay Ismail , called "the Bloodthirsty" (1672–1727), employed a corps of 150,000 black slaves, called his Black Guard . He used them to coerce the country into submission. [ 15 ] Modern conscription, the massed military enlistment of national citizens, was devised during the French Revolution , to enable the