Iranian History/Mahmud Ghaznavi
The most remarkable event in the history of medieval Iran was the rise of the Ghaznavid Empire. Islamic influence had gone moribund in the conquered areas by the 10th century AD as indigenous dynasties were replacing the Caliphate. While the rulers of these dynasties were mostly Muslim, the subjects followed an altered form of Islam by incorporating many elements of indigenized worship into Islam. It was even more worser in the borderlands of Afghanistan and India. Arab rule had almost completely disappeared from Sindh while Kabul and Gandhara achieved complete independence under the Buddhist and Hindu Shahis whose rule was regarded as a sort of golden age.
At about this time, anarchy prevailed in Eastern Iran which was ruled by three indigneous dynasties, the Tahirids, the Saffarids and the Samanids that constantly fought with each other. Mahmud, a Turkish chieftain of Ghazni i Aghanistan, award of his strength and influence, destroyed these kingdoms one after the other and united the whole of Eastern Iran into the Ghaznavid Empire and adopted Persian culture, language and traditions. But more than just being a patron of Persian culture, he also zealously propagated the Persianized form of Islam during his invasions of Afghanistan and India.
Mahmud was the son of Sabuktigin, a Turko-Persian slave of the Yamini tribe who served Alptigin, the Turkish adventurer. Alptigin was earlier awarded the province of Ghazni is eastern Afghanistan by the Caliph of Baghdad in return for his military assistance. On Alptigin's death, Sabuktigin seized control of the kingdom and along with his son Mahmud brought the most of Afghnaitsna, Khorasan and eastern Iran under his sway. Sabuktigin's expansionist designs often brought him into conflict with Jayapala, the Hindu Shahi ruler of Kabul. A number of wars were fought without any significant results. Sabuktigin died in 997 and was succeeded by his son, Mahmud Ghaznavi.
Prior to his assumption of kingship, Mahmud had led the Ghaznavid contingent deployed in the Samanid Empire. In 994, he assisted the Samanid king Nuh II in the successful conquest of Khorasan.
Camapaign against the Karakhanids
Soon after his assumption of the throne, Mahmud launched a military campaign against the Karakhanids. However, this campaign was unsuccessful. With the aid of the Seljuk Turks of Samarkand and Khwarezm, Mahmud was able to safeguard his position and negotiate a truce with the Karakhanids.
Conquest of the Samanid kingdom
In 999, Abdul Malik II, who succeeded Nuh II broke his alliance with Ghazni and attacked Mahmud's forces stationed in Khorasan. Mahmud Ghaznavi attacked Bukhara to punish the king. At the same time, the Karakhanids invaded Bukhara from the north and beseieged the city. Faced with a desperate situation, Abdul Malik II fled the city. The Ghaznavid forces succesffully conquered Bukhara and pursued Abdul Malik II who was captured and imprisoned. With Abdul Malik II's defeat in 999, the Samanid Empire came to an end.
Conquest of Sistan and Peshawar
Soon after his victorious campaign against the Samanids, Mahmud turned his attention to the Saffarid king Khalaf who had taken advantage of the war of succession in Ghazni to conquer Kohistan and Baghdis from the Ghaznavids. In 1000, Mahmud sent a large army and defeated Khalaf forcing him to return all his conquests. He, then, turned his attention to the east and defeated the Hindu Shahi ruler and seized Peshawar and Gandhara in 1001. Unable to bear the humiliation, the ruler Jaipala Shahi committed suicide. Meanwhile, Khalaf had taken advantage of Mahmud's absence from Sistan to sanction an invasion of Kirman under his son Tahir. Tahir successfully took Kirman, but on conclusion of his war with the Shahis, Mahmud returned and defeated Tahir and reconquered the province. Shortly afterwards, Khalaf's tyrannical rule triggered a full-scale rebellion in the kingdom. The rebels invited Mahmud Ghaznavi to save them from the tyranny of Khalaf. Mahmud entered the city and successfully vanquished the Saffarid forces. Khalaf tried to escape, but was captured by Mahmud and imprisoned. With Khalaf's defeat and capture, the Saffarid dynasty which had ruled Sistan for about two centuries came to an end. Sistan was subsequently incorporated as a province of the Ghaznavid Empire.
Invasions of North India 1000 - 1026
Mahmud launched his first invasion of India in 1000 when he defeated a confederacy of Rajput tribes to conquer Peshawar and Gandhara. For the next few years, he was occupied with campaigns against the Saffarid monarch of Sistan. Mahmud returned in 1002, and from 1000 to 1026, launched 17 military campaigns against the Rajput kingdoms of North India. He destroyed the Arab states of Al Mansurah and Al Mamurah and wiped out the Hindu Shahi kingdom of the Punjab. His most easterly thrust took him as far as Kanauj and Lucknow in the vicinity of Bengal.
End of the Hindu Shahi kingdom
Following the defeat of Anandapala and the fall of Peshawar, Anandapala's son Trilochanapala set up his capital at Lahore. In 1009, he made a last ditch effort to reconquer lost territories by leading the combined armies of Kanauj, Thaneswar, Multan, Ajmer, Kashmir and Bhopal against Mahmud Ghaznavi. But Ghaznavi defeated the combined Rajput armies in a titanic battle in the Punjab. Lahore was taken and the whole of Western Punjab was occupied by Ghaznavi. Triclochanapala fled to Kangra which was besieged and destroyed by Mahmud Ghaznavi in 1016. With his death, the Hindu Shahi dynasty came to an end.His successors sought refuge in Kashmir and married into the Kashmir royal family.
Sacking of Somnath
The single event for which Mahmud is popular, or rather, unpopular, is the sacking of the temple of Somnath in Gujarat. Despite the persistent pleas of the temple workers and priests, Mahmud destroyed the main idol of Lord Shiva and robbed the temple entirely. Mahmud also destroyed many other Hindu temples during his invasions of India. The steps of the Jama Masjid built by Mahmud in Kabul is believed to be made up of idols taken by Ghaznavi from his Indian invasions.