Mahmud of Ghazni, (Persian: محمود غزنوی, Maḥmūd-e Ghaznawī; (2 November 971 – 30 April 1030) commonly known as Mahmud Ghaznavi, was the ruler of the Ghaznavid Empire from 997 until his death. He turned the former provincial city of Ghazni into the rich capital of an extensive empire which included modern-day Afghanistan, most of Iran, and parts of north-west India including modern-day Pakistan. He was also the first ruler to carry the title Sultan, signifying his break from the power of the Islamic Caliph.
Mahmud of Ghazni was known as Yāmīn al-Dawlah Maḥmūd (in full: Yāmīn al-Dawlah Abd al-Qāṣim Maḥmūd ibn Sebük Tegīn). He was the eldest son of Emir Sebüktegin. When he was young, Mahmud helped his father gain land through military campaigns against Turk nobles. In 997, he overthrew his younger brother, Ismail, who had been nominated for the throne after his father’s death. As soon as he had the throne, he went out to conquer territory.
Between 1000 and 1026, he invaded India at least 17 times. He led the first major Muslim army to invade India. His conquest of the entire Punjab including Haryana all the way up to Agra was the last invasion where he increased his territory in India. From then on, most of Mahmud’s raids were to gain wealth. Mahmud's last and most famous raid was on Somnath. This is a temple city on the Gujarati coast that was also a pilgrimage site. The temple had many riches: heavy golden chains and thousands of jewels. The battle was violent, and more than 50,000 people died. Mahmud's army won and plundered the temple of its riches and wealth.
With all his riches, Mahmud founded a university, a library, and a museum, a grand mosque and richened his capital. When Mahmud was about to die, he ordered all of his riches to be placed before him. Mahmud died on 30 April 1030.

Ghor and Muhammad ibn Suri are then captured by Mahmud, made prisoner along with Muhammad ibn Suri's son, and taken to Ghazni, where Muhammad ibn Suri dies. Appoints Sewakpal to administer the region. Anandapala flees to Kashmir, fort in the hills on the western border of Kashmir. Mehmud attacks the fort but fails to capture it so he destroys every village in Kashmir during his retreat back to Afghanistan. He also defeats an army near Mirpur and captures the area appointing a Muslim governor. He establishes a caravan in the modern day city of Rawalpindi and fully annexes the Pothohar region.


In 1026, warriors of the Jats, the indigenous population of Sindh, inflicted heavy losses on Mahmud's army when he retreated from Somnath to Multan. Mahmud returned a year later to take revenge on the Jats, who had been stubbornly resisting forced Islamisation since the eighth century. As the contemporary writer Gardizi reports, Mahmud had 1,400 boats built; each boat was to carry 20 archers and be equipped with special projectiles that could be filled with naphtha. Mahmud's fleet sailed down the Jhelum and then the Indus, until it met the Jat fleet. Although the Jats had far more boats than Mahmud, their fleet was set ablaze and destroyed.