The Ghaznavid dynasty ruled eastern Afghanistan and parts of Iran and Pakistan from 977 to 1186. Sebuk Tigin (r. 977–997), a former slave, founded the empire, ruling from the city of Ghazna, from which the dynasty obtained its name. Sebuk-Tigin had been a slave of the Turks and the military force that he led to supplant the previously ruling Samanid dynasty was also Turkish in origin.
The Samanids were Iranian Muslims and the Ghaznavid Empire was also Muslim dominated, especially under subsequent rulers who were keen to Islamize the pagan-leaning Turks. The founder expanded his territory to the borders of India, with his son Mahmud of Ghazni (r. 998–1030). Eventually the Ghaznavids in the west and the Qara-Khanids to the east replaced the Samanids, with the Oxus River marking the border between them.
It was during Mahmud’s reign that the Ghaznavid Empire reached its greatest extent, spanning from the Oxus to the Indian Ocean. However the death of Mahmud and the succession of Masud (r. 1031–41), ousting the short-term ruler Mehmed, proved the turning point of Ghaznavid fortunes as increasing pressure by the Seljuk Turks resulted in the Battle of Dandanqan in 1040, a disastrous defeat for Masud.
Despite the much larger numbers of Ghaznavid troops, the more mobile cavalry of the Seljuk dynasty denied them access to water and other supplies and destroyed their morale. The battle caused the loss of the gained Iranian and Central Asia territory. The Ghaznavid Empire persisted until 1186, but its influence was greatly reduced and it is remembered largely by its artistic and cultural achievements rather than its temporal power.
One of the most famous of Persian or Iranian poets was Firdawsi, whose masterpiece the Shahnamah (The epic of kings) was completed under the patronage of Mahmud. The epic tells the history and traditions of Persia and the stories of its rulers.
It is considered a central part of Iranian culture and one of the world’s great works of literature. Mahmud’s patronage enabled him to recreate the Ghaznavid Empire as an Islamic state, which strengthened faith across the region the Ghaznavids controlled.
The resulting artistic influence can be seen in the cultural production created within the Seljuk world. This included architectural forms and figurative painting styles. Ghurids captured Ghazna in 1149 and the last remaining outpost of Lahore in 1187. The city of Lahore was greatly increased by this and subsequently become a significant urban and cultural center.