Prologue: a vow at Ghazni
In 999 a young Turkish ruler ascended the throne of Ghazni, a principality in Afghanistan, and vowed to conduct operations in India every year. Mahmud kept his word. For the next quarter century his armies came down through the passes, defeated the kings of the Punjab, and swept as far as Mathura, Kanauj and the Gujarat coast. He annexed only the Punjab and Multan; everything else he plundered and left.
Medieval Muslim historians made him a hero of Islam. To Hindus, as John Keay puts it, 'this paragon of valour and piety would ever be nothing but a monster of cruelty and iconoclasm'. Between those verdicts lies a harder question: what did Mahmud actually want, and what did his raids change?
1. The rise of Ghazni
At the end of the ninth century the Samanids, Iranians by descent, ruled Transoxiana, Khorasan and parts of Iran. One of their governors, a Turkish slave named Alptigin, marched to Ghazni in 963 and set himself up as an independent ruler. His successor Sabuktigin (977) carried the fight into the territory of the Hindu Shahis, the kings of Afghanistan and the Punjab, and around 990–91 inflicted a decisive defeat on them; Kabul and Jalalabad were annexed. The contemporary historian Utbi wrote that 'from this time the Hindus drew in their tails and sought no more to invade the land' of Ghazni.
Mahmud succeeded in 998, by one account, or 999, by another, and reigned till 1030. Ghazni under him became a formidable power in the eastern Islamic world. Its interests, Romila Thapar stresses, lay mainly in Central Asia, where holding Khwarazm and Turkestan on the China–Mediterranean trade was far more lucrative than holding north India; Mahmud turned 'with remarkable speed from raids in India to campaigns in central Asia'.

2. The fall of the Hindu Shahis
Mahmud's first great enemy was the Hindu Shahi king Jayapala, who had extended his kingdom from Peshawar to the Beas. In a furious battle near Peshawar, in 1001 by one account or 1000 by another, Mahmud's 15,000 picked cavalry, ghazis and Afghans defeated him and ravaged his capital Waihind. Some accounts say Jayapala was captured and ransomed; Satish Chandra doubts this, since Mahmud made peace and annexed only the land west of the Indus. Feeling his defeat a humiliation, Jayapala entered the funeral pyre a few years later.
His son Anandapala fought on. Mahmud won the upper Indus in a hard battle in 1006, and in 1009 triumphed over Anandapala in the plains of Chhachh east of the Indus, overrunning the Shahi capital at Nandana in the Salt Range. Anandapala made a treaty and soon died. In 1015 Mahmud took Lahore, extending his empire to the Jhelum, and overran Multan, whose Muslim ruler had sided with Anandapala. That same year his attempt on Kashmir failed in bad weather, his first defeat in India. Queen Didda of Kashmir, a rival of the Shahis, had given them no help, and Satish Chandra finds that none of the other Rajput rajas helped Anandapala either.
3. The great raids
With the Punjab in hand, Mahmud raided Nagarkot in the hills and Thanesar near Delhi. His most daring raids were against Kanauj in 1018 and Somnath in 1025. In the first he sacked Mathura, whose temples he thought were 'not built by man but by Jinn', and Kanauj, the Pratihara capital, and came home by Kalinjar loaded with riches; Satish Chandra calls it his 'most spectacular and profitable forage'. A Turkish army's attack on Kanauj in 1018, Thapar notes, virtually ended Pratihara rule. He fought the Chandella Vidyadhara but settled for a nominal tribute.
Then came Somnath. Mahmud marched from Multan across Rajputana, in the winter of 1025–26, and met no serious resistance on the way. He raided the temple, desecrated it and broke the image; Thapar dates the raid to 1026. Somnath was renowned for its wealth: it drew taxes from pilgrims, and Arab sources speak of temples investing in commerce beside the busy port of Veraval. On his way back Mahmud sacked Mansura in Sind too. It was his last campaign in India outside the Punjab. He died at Ghazni in 1030.

4. What did Mahmud want?
Satish Chandra calls the later raids plundering expeditions aimed at the rich temples and cities of the north, to pay for his struggles in Central Asia and to deny Indian princes time to regroup. Mahmud also posed as a but-shikan, a 'destroyer of images', for the glory of Islam, and his iconoclasm earned him a title from the Caliph of Baghdad. Thapar adds a commercial motive for Somnath: Mahmud may have wanted to cut the import of horses by Arab traders, to the benefit of Ghazni's own horse traders.
His victims were not only Hindus. In Multan he attacked the Muslim rulers, who belonged to a sect he bitterly opposed, and the mosque of its Shia Muslims, since as an ardent Sunni he regarded Shias and Ismailis as heretics. In Sistan, by Irfan Habib's account, his troops massacred Muslims in the Friday Mosque and Christians in a church, and a history of Sistan dates the beginning of its people's suffering from his conquest. Later historians of Khorasan remembered him as a greedy tyrant: Mir Khwand refused to give his name any commendatory epithet because of his avarice and extortions.
5. Why the north could not resist
Mahmud could raid at will, Satish Chandra writes, because no strong state existed in north India at the time; the Pratiharas, Palas and Rashtrakutas had worn each other down. The Indian kings, Thapar observes, seem to have been oblivious to the larger danger even though his raids lasted more than two decades. The Turkish cavalry of mounted archers carried the day against more numerous Indian forces. And Al-Biruni, who came to India in the wake of Mahmud's armies, recorded the result:
“The Hindus became like the atoms of dust scattered in all directions and like a tale of old in the mouths of people. Their scattered remains cherish of course the most inveterate aversion towards all Muslims.”
6. Somnath: the history of a memory
The popular view, Romila Thapar writes, is that the raid on Somnath was such a trauma for Hindus that it became seminal to Hindu-Muslim antagonism in recent times. Yet she finds no reference to the raid in contemporary or near contemporary local sources beyond a passing mention in a Jaina text, and no discussion of a reaction, let alone a trauma. The temple was renovated. Two centuries later, in the thirteenth century, a wealthy ship-owning merchant from Hormuz was given permission by the town's authorities to build a mosque near it and buy property to maintain it.
The raid's fame, she argues, grew in the Turko-Persian chronicles, retold up to the seventeenth century with much fantasy, as Mahmud was gradually projected from iconoclast and plunderer into the founder of Islamic rule in India, 'even if the latter is not quite what he was'. Al-Biruni's sober account, by contrast, described a lingam in a temple about a hundred years old, standing in a fort on the edge of the sea and venerated by sailors.
7. The court of Ghazni

Mahmud's wealth made Ghazni a centre of Persian culture. Satish Chandra links him with the renaissance of the Iranian spirit, which reached a high-water mark in the Shah Namah of Firdausi, his poet-laureate; Al-Biruni enjoyed his patronage, as did the historian Utbi, though another account says Al-Biruni never sought it and had only a casual contact with the court. A later historian concedes that he was accused of avarice, but that 'no king ever had more learned men at his court, kept a finer army, or displayed more magnificence'.
After his death the Seljuks rose in Central Asia and defeated his son Masud, and the Ghaznavid empire shrank to Ghazni and the Punjab, which it held till 1186. The Ghaznavids went on raiding the Ganga valley and Rajputana, but they no longer posed a serious danger. Yet the door Mahmud had opened stayed open: the Turks, Satish Chandra writes, had crossed the mountains that defended India and could strike into the Gangetic heartland at any time.
The verdict
Mahmud was a Central Asian empire-builder who used India as a treasury. His raids broke the Hindu Shahis, ended Pratihara power at Kanauj, enriched Ghazni and made him a champion of Islam in the eyes of the Caliph. He plundered Muslims and Christians as readily as Hindus when it suited him. His one lasting conquest, the Punjab, brought Turkish power to the edge of the Ganga plain; the story of Somnath, retold for centuries, became a weapon of memory long after the temple itself was rebuilt.
Timeline
- 963 Alptigin makes himself independent at Ghazni
- 977 Sabuktigin succeeds
- c. 990–91 Decisive defeat of the Hindu Shahis; Kabul and Jalalabad annexed
- 998 or 999 Mahmud ascends the throne
- 1000 or 1001 Jayapala defeated near Peshawar
- 1009 Anandapala defeated in the plains of Chhachh
- 1015 Lahore taken; failure in Kashmir
- 1018 Mathura and Kanauj sacked
- 1025–26 Somnath raided
- 1030 Mahmud dies at Ghazni
- 1186 End of Ghaznavid rule in the Punjab
Key terms
- Hindu Shahis
- The dynasty of Afghanistan and the Punjab, with capitals at Waihind and Nandana, overthrown by Mahmud.
- Ghazi
- A warrior for the faith; Mahmud recruited ghazis for his Indian raids.
- But-shikan
- 'Destroyer of images', a title Mahmud claimed.
- Shah Namah
- Firdausi's Persian epic, written at Mahmud's court.