For 10 points, identify this patron of Ferdowsi and habitual raider of northern India, the most powerful ruler of the Ghaznavid Dynasty.
This ruler's homosocial relationship with the Georgian slave Malik Ayaz inspired numerous songs and poems by later authors and led to Ayaz being installed as the king of a conquered city. This leader rose to power after defeating his brother Ismail in a battle named for his future capital and confined that brother to a castle in Joorjan. The author of the most famous literary work produced under this king's patronage was supposedly cheated of most of his payment by a spiteful courtier who switched the gold this ruler had allocated for the author with silver. This ruler's defeat of Khalaf ibn Ahmad ended the Saffarid Dynasty. This leader sacked the (*) Somnath Temple, destroying its jyotirlinga and using the gold from it for a mosque in his capital. This ruler was the first to use the title "sultan" and is best known for his 17 campaigns east of the Khyber Pass. For 10 points, identify this patron of Ferdowsi and habitual raider of northern India, the most powerful ruler of the Ghaznavid Dynasty.
This ruler's homosocial relationship with the Georgian slave Malik Ayaz inspired numerous songs and poems by later authors and led to Ayaz being installed as the king of a conquered city.
Mahmud of Ghazni or Yamīn-ud-Dawla Abul-Qāṣim Maḥmūd ibn SebÃ¼ktegīn