Ghazni under the Ghaznavids

Ghazni is a city in southeastern Afghanistan, which served as the capital of the Ghaznavid Empire from 977 to 1163.

Etymology
The toponym Ghazni is known to have existed prior to the Islamic period. It is derived from the Iranian word Ganzak ("treasury"). Classical authors mention the name in various forms, including the Greek Gázaca (Γαζαχα), and the Chinese Ho(k)-si(k)-na.

Background
Although not a member of the Ghaznavid family, the foundation of the Ghazni as a Ghaznavid city can be attributed to the Turkic slave commander of the Samanid Empire, Alp-Tegin, who after his unsuccessful attempt to put the Samanid prince Nasr on the throne, was forced to flee from the court in Bukhara. In 963, Alp-Tegin accompanied by his personal guard of Turkic slave-soldiers and group of Iranian ghazis left for Ghazni, which was a small town in Zabulistan ruled by the local Lawik dynasty. He seized Ghazni from Abu Bakr Lawik, a kinsman of the Kabulshah, and secured his position by receiving an investiture from the Samanids as the governor of Ghazni.

Alp-Tegin died a few months later (September 963) and was succeeded by his son Abu Ishaq Ibrahim, who briefly lost control of Ghazni after an invasion by its former ruler, Abu Bakr Lawik. However, he managed to regain it with Samanid aid. Some time later, Abu Ishaq Ibrahim died and was succeeded by a Turkic slave commander named Bilgetegin.

Under the Ghaznavid rulers
In 1052, the rebellious slave-soldier (ghulam) Toghrul seized Ghazni, had Abd al-Rashid killed, and had the sultan's men jailed in a stronghold. However, Toghrul's reign lasted only 15 days; he was defeated and killed by Ghaznavid loyalists, who put Farrukh-zad (r. 1053–1059) on the throne.

The city's good fortune came to an unexpected and ruthless end when it was sacked and set on fire in 1151 by the Ghurid Sultan Ala al-Din Husayn (r. 1149-1161). All the tombs of the Ghaznavid rulers, with the exception of Mahmud, Mas'ud I and Ibrahim, were broken open and the remains burned. From these events, Ala ad-Din Husayn gained the nickname, Jahānsūz (meaning the World Burner).

Monuments and inscriptions
Sultan Mas'ūd III of Ghazni built one of the Ghazni Minarets and the Palace of Sultan Mas'ūd III.