Unlike most other dynasties of Iranian history, the Ghaznavids are not known through their family or clan name, but rather by the name of the region over which they ruled. This indeed is indicative of the manner of their ascendance to power, starting with a Turkic commander of the Samanid armies, and sometimes governor of various cities in Khorasan, Aleptegin.
Following various appointments as the commander of the army and governor of localities in Khorasan, Aleptegin, previously a Turkish slave of the Samanid Amir Abdul Malik I (954-961), concluded his old rivalry with another Turkish commander, Abulhasan Simjur, and established himself in Ghazni in 962. His rivals, the Simjuris, managed to establish their candidate, Amir Mansur, on the Samanid throne and for a while, enjoyed supremacy in the Samanid realms, particularly in Khorasan. Aleptegin passed away in 963 and was succeeded by his former slave, and now commander, Sebuktegin, who was also from an Oghuz Turkish tribal background and had become a military slave of Aleptegin in his youth. Sebuktegin’s efforts in expanding his fiefdom saw him become the master of Tokharistan and Zawulistan, and eventually expand his power into Khorasan, as well as over the Hinu-Kush mountains into northern India. When, in 997 Sebuktegin died, he left an expanding kingdom to his eldest son, Ismail I. The reign of the latter was, however, quite short lived, and he was soon replaced by his more energetic brother, Mahmoud I, who is considered the true founder of the Ghaznavid power.
Sultan Mahmoud of Ghazni quickly embarked upon the expansion of his kingdom. In the year 1000, through an alliance with the eastern Turkic Karakhanid dynasty and destroyed the Samanid dynasty in Bukhara. After this point, Bukhara and Transoxiana became part of the empire of the Karakhanid Nasr Khan, while Khorasan and the rest of the Iranian Plateau became the domain of Mahmoud. Securing his northern flank, Mahmoud quickly turned towards his southern rivals, the Hindu Shahi dynasty of Kabul who had ruled in that region for many generations, and then quickly moved over the mountains into Gandhara and northern India. By 1010, Mahmoud was in charge of the riches of India which were carried over to Ghazni. Formerly a small provincial town of the larger kingdom of Zawulistan, Ghazni was now transformed into the capital of an empire that extended from Multan to Neishapur. Mahmoud built great palaces and mosques in Ghazni and sent out missions of conversion to Islam with zeal. Ghazni and its famous gardens then became the refuge of many of the most famous Persian poets, including Farrokhi, Asjodi, Manuchehr, and Sana’i. It is reputed that even the famous Zoroastrian poet, Daghighi, was a retainer at the Ghaznavid court, and despite all its legendary connotations, even the great Ferdowsi himself had connections with the court of the great Sultan. It is also during this golden age that Mahmoud gave up the old title of Amir (prince), instead opting for the grand title of Sultan (“sovereign”) on his coins, although he continued to mint coins in the name of the ruling caliph in Baghdad.
Mahmoud’s efforts to control the power of the Karakhanids had led to a dangerous alliance with the descendants of Seljuk, leaders of a Quz clan who had moved westwards in the late decades of the 10th century. When the Seljuks started to establish themselves in Khorasan and even defeated Mahmoud’s armies in several occasions, Mahmoud started a great campaign to the west which saw not only the temporary submission of the Seljuks, but also the destruction of the power of the Deylamite rulers in Tabaristan, as well as that of the descendants of Fakhr ol-Dowleh, the Buyid king, in Rey and other parts of northern Iran. By 1024, Mahmoud had become the master of most of the Iranian Plateau east of the Zagros range, as well as the Hindu Kush region, not to mention most of northern India.
Sultan Mahmoud passed away in 1030, leaving a rich and strong empire to his son, Sultan Mohammad I. The empire, however, was already on the brink of decline, as the Seljuk threat was quite evident on the western borders of the Ghaznavid territory. Under Masu’d I (1031-1041) Mohammad’s brother and successor, the Ghaznavid Empire started to crumble, particularly after a battle with the Seljuks in 1040 where all of Khorasan and Transoxiana was lost to the Seljuk lords Toghril and Chghri Beg. Mas’uds reign became famous, however, through the famous History of Beyhaghi, written by an otherwise unknown secretary of Mahmoud’s court, Abolfazl Beyhaghi, a work which is considered one of the monuments of Persian literature.
Modud, Mas’ud’s son, ruled until 1050 and further plunged the country into trouble. During his time and that of his immediate successors, the Ghaznavid base in Ghazni was threatened and the Sultan tended to take refuge more and more in northern India, with the result that Lahore was raised in importance. It was under the long rule of Ibrahim, the youngest son of Mas’ud from 1059-1099 that Ghaznavid decline was temporarily halted. Ibrahim concluded a treaty with the Seljuks that reduced the Ghaznavids as vassals of the Seljuks, while leaving them in peace in Ghazni and northern India. Ibrahim then managed to build up the treasury of the Ghaznavids again and create a new center of cultural and artistic patronage in Ghazni.
A new threat, however, was facing the Ghaznavids from the north, this time in the shape of the Ghurid commanders. Several Ghurid attacks were repelled, while a blowing defeat in 1151 saw the total destruction of Mahmoud’s glorious capital. The Ghaznavid ruler Bahramshah was restored to the throne and to Ghazni through the help of the Seljuks, now his sovereign lords, although Ghurids soon recaptured the city. Khosrow Malek, the last of the Ghaznavids, thus only held power in Lahore until 1186. In that year, the expanding Ghurid power, having deprived him of his other possessions in Punjab, including Peshawar and Multan, managed to capture Lahore, the last remaining Ghaznavid city. Khosrow Malek died shortly after in captivity.