The context behind the rise of the Delhi Sultanate in India was part of a wider trend affecting much of the Asian continent, including the whole of southern and western Asia: the influx of nomadic Turkic peoples from the Central Asian steppes. This can be traced back to the 9th century, when the Islamic Caliphate began fragmenting in the Middle East, where Muslim rulers in rival states began enslaving non-Muslim nomadic Turks from the Central Asian steppes, and raising many of them to become loyal military slaves called Mamluks. Soon, Turks were migrating to Muslim lands and becoming Islamicized. Many of the Turkic Mamluk slaves eventually rose up to become rulers, and conquered large parts of the Muslim world, establishing Mamluk Sultanates from Egypt to Afghanistan, before turning their attention to the Indian subcontinent.
It is also part of a longer trend predating the spread of Islam. Like other settled, agrarian societies in history, those in the Indian subcontinent have been attacked by nomadic tribes throughout its long history. In evaluating the impact of Islam on the subcontinent, one must note that the northwestern subcontinent was a frequent target of tribes raiding from Central Asia in the pre-Islamic era. In that sense, the Muslim intrusions and later Muslim invasions were not dissimilar to those of the earlier invasions during the 1st millennium.
By 962 AD, Hindu and Buddhist kingdoms in South Asia were under a wave of raids from Muslim armies from Central Asia. Among them was Mahmud of Ghazni, the son of a Turkic Mamluk military slave, who raided and plundered kingdoms in north India from east of the Indus river to west of Yamuna river seventeen times between 997 and 1030. Mahmud of Ghazni raided the treasuries but retracted each time, only extending Islamic rule into western Punjab.
The wave of raids on north Indian and western Indian kingdoms by Muslim warlords continued after Mahmud of Ghazni. The raids did not establish or extend permanent boundaries of their Islamic kingdoms. The Ghurid sultan Mu'izz ad-Din Muhammad Ghori, commonly known as Muhammad of Ghor, began a systematic war of expansion into north India in 1173. He sought to carve out a principality for himself by expanding the Islamic world. Muhammad of Ghor sought a Sunni Islamic kingdom of his own extending east of the Indus river, and he thus laid the foundation for the Muslim kingdom called the Delhi Sultanate. Some historians chronicle the Delhi Sultanate from 1192 due to the presence and geographical claims of Muhammad Ghori in South Asia by that time.
Ghori was assassinated in 1206, by Ismāʿīlī Shia Muslims in some accounts or by Hindu Khokhars in others. After the assassination, one of Ghori's slaves (or mamluks, Arabic: مملوك), the Turkic Qutb al-Din Aibak, assumed power, becoming the first Sultan of Delhi.