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.