Ghilman (singular Arabic: ghul?m,[note 1] plural ghilm?n)[note 2] were slave-soldiers and/or mercenaries in the armies throughout the Islamic world, such as the Abbasid, Samanid, Ottoman, Safavid, Afsharid and Qajar empires. Islamic states from the early 9th century to the early 19th century consistently deployed slaves as soldiers, a phenomenon that was very rare outside of the Islamic world.
The ghilman were slave-soldiers taken as prisoners of war from conquered regions or frontier zones, especially from among the Turkic people of Central Asia and the Caucasian peoples (Turkish: Kölemen). They fought in bands, and demanded high pay for their services.
The use of slave soldiers in the Islamic world stretches back to 625 when African slave soldiers were mentioned serving under Mohammed and the Rashidun Caliphate. Slavs and Berbers were also used under the Umayyad Caliphs. However it was only in the mid-9th century that this became used on a large scale.
Ghilman were introduced to the Abbasid Caliphate during the reign of al-Mu'tasim (r. 833-842), who showed them great favor and relied upon them for his personal guard. Accounts cite that their numbers increased in the caliphal household as Mu-tasim tried to address the court factionalism. These slave-soldiers were opposed by the native Arab population, and riots against them in Baghdad in 836 forced Mu'tasim to relocate his capital to Samarra.
The use of ghilman reached its maturity under al-Mu'tadid and their training was conceived and inspired through the noble furusiyya. From a slave, a ghulam attained his freedom after completing the formative training period and joined the elite corps as a mounted warrior. The ghilman rose rapidly in power and influence, and under the weak rulers that followed Mu'tasim, they became king-makers: they revolted several times during the so-called "Anarchy at Samarra" in the 860s and killed four caliphs. Eventually, starting with Ahmad ibn Tulun in Egypt, some of them became autonomous rulers and established dynasties of their own, leading to the dissolution of the Abbasid Caliphate by the mid-10th century.
A ghulam was trained and educated at his master's expense and could earn his freedom through his dedicated service. Ghilman were required to marry Turkic slave-women, who were chosen for them by their masters. Some ghilman seem to have lived celibate lives. The absence of family life and offspring was possibly one of the reasons why ghilman, even when attaining power, generally failed to start dynasties or proclaim their independence. The only exception to this was the Ghaznavid dynasty of Afghanistan.
Slave soldiers became the core of Islamic armies as the Bedouin, Ghazi holy warriors and Hashariyan conscripts were not as reliable, while Ghilman were expected to be loyal as they had no personal connections to the rest of society. However, the Ghilman often did not remain as loyal as expected.
The Buyids and likely the Tahirids also built armies of Turkish slave soldiers. The Saffarids drew slave soldiers from Turks, Indians and Africans. The Ghaznavid dynasty, which originated from a slave soldier of the Samanids, also built their military around slave soldiers, first Turks and later Indians. The Turkish Seljuks and their successors the Ghurids and the Turkic Khwarazmian dynasty also continued with an army of mainly Turkish slave soldiers. Seljuk regional princes were each placed under the tutelage of slave soldier guardians (at?bak) who formed their own dynasties. After a brief interruption under the Mongols, the institution returned under the Qara Qoyunlu and Aq Qoyunlu Turkmens. The various Iranian dynasties (Safavid, Afsharid, Qajar) drew slave soldiers from the Caucasus such as Georgians, Circassians and Armenians.
The Delhi Sultanate also made extensive use of Turkish cavalry ghilman as their core shock troops. After Central Asia fell to the Mongols they switched to capturing Hindu boys to convert into Islamic slave soldiers.
There were violent ethnic conflicts between the different groups of ghilman, the Turks, Slavs, Nubians and Berbers in particular.
The Quran mentions ghilman in verse 52:24: "There will circulate among them ghilman for them, as if they were pearls well-protected." Ghilman are traditionally described as servant boys provided especially for believers in heaven. In verse 56:17: "There will circulate among them [the faithful in heaven] young boys made eternal" -- "them" refer to the faithful in heaven and "young boys made eternal" to ghilman. Descriptions of the ghilman by tenth and sixteenth-century theologians were focused on their beauty. Their commentaries also hold that the extratemporal parameters of the Paradise, which the young servants inhabit, are also extended to them so that they do not age or die.
Some have suggested that just as wine is forbidden to Muslims on earth but allowed in heaven, so to prohibitions on homosexuality might not apply in heaven where there is no need for procreation, and that the ghilman might be the male equivalent of the famously beautiful female houris that the faithful marry in heaven. Others scholars have vehemently denounced this idea and stated that the verse "says that they [the youth] will serve the inhabitants of Paradise, and will go around taking food and drink to them, and no more than that."