Malik Ayaz, son of Aymāq Abu'n-Najm, was a slave from Georgia who rose to the rank of officer and general in the army of Sultan Mahmud of Ghazni (also known as Mahmud Ghaznavi). Malik Ayaz's chaste love of Mahmud inspired poems and stories,  while local Muslim historians and Sufis commemorate Malik Ayaz due to his unwavering feudalistic loyalty to Mahmud Ghaznavi.
Early life and feudal career
In 1021, the Sultan raised Ayaz to kingship, awarding him the throne of Lahore, which the Sultan had taken after a long siege and a fierce battle in which the city was torched and depopulated. As the first Muslim governor of Lahore, he rebuilt and repopulated the city. He also added many important features, such as a masonry fort, which he built in the period of 1037-1040 on the ruins of the previous one, demolished in the fighting, and city gates (as recorded by Munshi Sujan Rae Bhandari, author of the Khulasatut Tawarikh (1596 C.E.). The present Lahore Fort is built in the same location. Under his rule of the city became a cultural and academic center, renowned for poetry.
The tomb of Malik Ayaz can still be seen in the Rang Mahal commercial area of Lahore. The tomb and the garden was destroyed by the Sikhs during their rule of Lahore and the tomb was rebuilt after the independence of Pakistan.
Malik Ayaz in Sufism
Amjad Farid Sabri the slain Qawwal of Pakistan performed a song dedicated to Malik Ayaz, which praises the man for his feudalistic loyalty to Mahmud of Ghazni, the song also mentions Ajmer Sharif Dargah and how it attracts female devotees with the same devotion.
- James Neill (27 October 2008). The Origins and Role of Same-Sex Relations in Human Societies. McFarland. ISBN 978-0-7864-5247-7.