A Mamluk nobleman from Aleppo
, 19th century
The origins of the mamluk system are disputed. Historians agree that an entrenched military caste such as the mamluks appeared to develop in Islamic societies beginning with the ninth-century Abbasid Caliphate of Baghdad. When in the ninth century has not been determined. Up until the 1990s, it was widely believed that the earliest mamluks were known as Ghilman (another term for slaves, and broadly synonymous) and were bought by the Abbasid caliphs, especially al-Mu'tasim (833-842).
By the end of the 9th century, such warrior slaves had become the dominant element in the military. Conflict between these ghilman and the population of Baghdad prompted the caliph al-Mu'tasim to move his capital to the city of Samarra, but this did not succeed in calming tensions. The caliph al-Mutawakkil was assassinated by some of these slave-soldiers in 861 (see Anarchy at Samarra).
Since the early 21st century, historians suggest that there was a distinction between the mamluk system and the (earlier) ghilman system, in Samarra, which did not have specialized training and was based on pre-existing Central Asian hierarchies. Adult slaves and freemen both served as warriors in the ghilman system. The mamluk system developed later, after the return of the caliphate to Baghdad in the 870's. It included the systematic training of young slaves in military and martial skills. . The Mamluk system is considered to have been a small-scale experiment of al-Muwaffaq, to combine the slaves' efficiency as warriors with improved reliability. This recent interpretation seems to have been accepted.
After the fragmentation of the Abbasid Empire, military slaves, known as either mamluks or ghilman, were used throughout the Islamic world as the basis of military power. The Fatimid Caliphate of Egypt had forcibly taken adolescent male Armenians, Turks, Sudanese, and Copts from their families in order to be trained as slave soldiers. They formed the bulk of their military, and the rulers selected prized slaves to serve in their administration. The powerful vizier Badr al-Jamali, for example, was a mamluk from Armenia. In Iran and Iraq, the Buyid dynasty used Turkic slaves throughout their empire. The rebel al-Basasiri was a mamluk who eventually ushered in Seljuq dynastic rule in Baghdad after attempting a failed rebellion. When the later Abbasids regained military control over Iraq, they also relied on the ghilman as their warriors.
Under Saladin and the Ayyubids of Egypt, the power of the mamluks increased and they claimed the sultanate in 1250, ruling as the Mamluk Sultanate. Throughout the Islamic world, rulers continued to use enslaved warriors until the 19th century. The Ottoman Empire's devşirme, or "gathering" of young slaves for the Janissaries, lasted until the 17th century. Regimes based on mamluk power thrived in such Ottoman provinces as the Levant and Egypt until the 19th century.