Ghaznavids, A Muslim dynasty that ruled Afghanistan and neighboring Punjab for more than 200 years. It was founded by Alptigin (died 963), a Samanid slave, who conquered the strategic mountain town of Ghazni in 962 and made it into an independent kingdom. The greatest of the Ghaznavids was Sultan Mahmud of Ghazni (971-1030), Alptigin's grandson, who led numerous raids into the Punjab, looting Indian cities of enormous wealth that he used to convert Ghazni into one of the great centers of Islamic culture. Before his death Mahmud annexed the Punjab to his kingdom. Muhammad of Ghur (flourished 1174-1206) deposed the last Ghaznavid ruler of a reduced domain with the capital at Lahore in 1186. Afghan emperor and conqueror. He defeated (c.999) his elder brother to gain control of Khorasan (in Iran) and of Afghanistan. In his raids against the states of Northern India, Mahmud, a staunch Muslim, destroyed Hindu temples, forced conversions to Islam, and carried off booty and slaves. Hindus especially abhorred his destruction of the temple to Shiva at Somnath in Gujarat. Mahmud's territorial gains lay mainly Western and Northern of Afghanistan and in the Punjab. At Ghazni, his capital, he built a magnificent mosque.