Abu al-Qasim Mahmud ibn Sabuktigin (Persian: ابوالقاسم محمود بن سبکتگین, romanized: Abu al-Qāṣim Maḥmūd ibn Sabuktigīn; 2 October 971 – 30 April 1030), usually known as Mahmud of Ghazni or Mahmud Ghaznavi (محمود غزنوی), was Sultan of the Ghaznavid Empire, ruling from 998 to 1030. Widely reputed to be undefeated throughout his entire career, Mahmud was known by his honorific title Yamin al-Dawla (یمین الدوله, lit. 'Right Hand of the State'). At the time of his death, his kingdom had been transformed into an extensive military empire, which extended from present-day northwestern Iran proper to the Punjab in the Indian subcontinent, Khwarazm in Transoxiana.
Highly Persianized, Mahmud continued the bureaucratic, political, and cultural customs of his predecessors, the Samanids. He established the ground for a future Persianate state in Punjab, particularly centered on Lahore, a city he conquered. His capital of Ghazni evolved into a significant cultural, commercial, and intellectual centre in the Islamic world, almost rivalling the important city of Baghdad. The capital appealed to many prominent figures, such as al-Biruni and Ferdowsi.
Mahmud ascended the throne at the age of 27 upon his father's death, albeit after a brief war of succession with his brother Ismail. He was the first ruler to hold the title Sultan ("authority"), signifying the extent of his power while at the same time preserving an ideological link to the suzerainty of the Abbasid Caliphs. In the thirty-two years of his reign, he made thirty-five major and eleven minor campaigns.
Mahmud was born in the town of Ghazni in the region of Zabulistan (in present-day Afghanistan) on 2 October 971. His father, Sabuktigin, was a Karluk Turkic slave who laid foundations to the Ghaznavid dynasty in Ghazni in 977, which he ruled as a subordinate of the Samanids, who ruled Khorasan and Transoxiana. Mahmud's mother was a local woman of possible Iranian descent from a landowning aristocrat family in the region of Zabulistan, and he is therefore known in some sources as Mahmud-i Zavuli ("Mahmud from Zabulistan"). Not much about Mahmud's early life is known, other than that he was a school-mate and foster brother of Ahmad Maymandi, a Persian native of Zabulistan.
Originally Sultan Mahmud was a follower of the Hanafi school of law, but shortly after his accession to the throne he showed inclination towards the Karramite sect and ultimately changed over to the Shafi'i school of law. Although early in his reign Sultan Mahmud showed sympathies with the Karramiyya sect—evidenced by reports that he "would get angry for the Karramiyya" (yaghḍabu lil-Karramiyya). Following Mahmud's death Ghaznavid poet Farrukhi said the heretics can now sleep peacefully:
"Alas and alack, the Qarmatiyan can now rejoice! They will be secure against death by stoning or the gallows."
Mohammad Habib writes, according to contemporary gossip Mahmud had disbelief in the Day of Judgment and in the Hadith "that the scholars (ulama) are the successors of the prophets." He also suspected that Subuktigin was not his real father. Mahmud like other Muslim sovereigns paid visits to the renown Muslim saints. Among them Abu al-Hassan al-Kharaqani personally influenced him. According to one account, while returning to his palace one night, the Sultan ordered his golden lamp to be given to a poor student whom he saw reading in the light of a shop. That night the prophet Muhammad appeared to him in a dream and said, "Son of Subuktigin, may God honour thee in both the worlds as thou hast honoured my successor!" The Sultan's three doubts were thus removed.
Afterward, Mahmud came under the influence of the renowned scholar Abu Bakr 'Abdallah ibn Aḥmad al-Qaffal al-Marwazi, Abu Bakr al-Qaffal al-Marwazi a devout follower of the Ash'ari theological school and the Shafi'i madhhab. This shift reflected a broader move within the Ghaznavid court to align with Sunni orthodoxy, distancing itself from anthropomorphic sects like the Karramiyya and from Isma'ili theology. Mahmud's theological stance is described by Al-Dhahabi as that of an Athari in creed and Shafi'i in jurisprudence. He mentioned Mahmud as someone who inclined towards the Athar, quote:
"The Sultan was inclined towards the Athar, except that he was from the Karamiyya."
This quotation reflects his earlier theological position on creed, prior to his later shift towards the Shafi'i Athari view. Following his shift in creed, he was challenged by the Ash'ari theologian Ibn Furak, who contended that describing God as ‘above’ implied also describing Him as ‘below. He answered him by saying, quote:
Abu ʿAlī ibn al-Bannāʾ said: ʿAlī ibn al-Ḥusayn al-Akbarī narrated that he heard Abū Masʿūd Aḥmad ibn Muḥammad al-Bajalī say: Ibn Fawrak entered upon Sultan Maḥmūd and said: "It is not permissible to describe God as being above, because that would necessarily entail describing Him as being below. Whoever it is permissible for Him to have an above, it is permissible for Him to have a below." The Sultan replied: "I did not describe Him so that it would be necessary for me to do so. Rather, He described Himself."
It is reported from Ibn Taymiyyah in his book Bayan Talbis al-Jahmiyyah that Mahmud used to curse Ash'aris, claiming that they were among the "innovators" whom he deemed to be heretical. Quote:
"Sultan Mahmud ibn Sabuktigin relied on something similar to this in his kingdom, and he added to it by ordering the people of innovation to be cursed from the pulpits: so the Jahmites were cursed, and the Rafidis and the Haruriyya and the Mu'tazila and the Qadarites, and also the Ash'airah were cursed"
He knew Quran by heart and was familiar with Muslim law and tradition. According to Ghaznavid author Abu'l-Fadl Bayhaqi and poet Farrukhi Sistani, the sultan was punctilious in the performance of his religious duties and offered the regular prayers and read the Quran. In the month Ramadan, 2.5% Zakat was collected and spent on the poor. Mahmud did not tolerate any deviation in Muslim subjects. Censorship was applied and an officer was appointed to punish heresy or delinquency. The followers of the Isma'ili Shia Qaramatians and Batini sects were suppressed in the empire. They were captured and imprisoned if they did not recant they were often executed.
Mughal emperor Aurangzeb (r. 1658–1707) mentioned Mahmud as a sultan who suppressed heresy in his kingdom.
"Sultan Mahmud, may God forgive his crimes did not allow half hearted religious men and heretics to enter his court, nay not even his kingdom, so that other people might not be misled by seeing such persons in the form of the dervish, and they themselves might have no power to mislead others."
Mahmud married the daughter of Abu'l Haret Ahmad, and they had twin sons, Mohammad and Ma'sud, who succeeded him one after the other; his grandson by Mas'ud, Maw'dud Ghaznavi, also later became ruler of the empire. In 999, Mahmud married Kara-khanid ruler Ilig Khan's daughter. In December 999, Mahmud sent his representatives to Uzgand, capital of Nasr Illig to escort Khan's daughter to Mahmud's palace. The marriage was sealed in 1000 AD. He also had three brothers viz. Isma'il, his initial rival for the throne; Abu'l-Muzaffar Nasr, the long-serving military commander and governor; and Abu Ya'qüb Yusuf, the youngest, who eventually succeeded Nasr in his prestigious roles.
According to Mirat-i-Masudi ("Mirror of Masud"), a Persian-language hagiography written by Abdur Rahman Chishti in the 1620s, Mahmud's sister, Sitr-e-Mu'alla, was purportedly married to Dawood bin Ataullah Alavi, also known as Gazi Saiyyed Salar Sahu, whose son was Ghazi Saiyyad Salar Masud. Mahmud's companion was a Georgian slave, Malik Ayaz, about whom poems and stories have been told.