Malik Ayaz, from Georgia, started as a slave but worked hard to become an officer in Sultan Mahmud of Ghazni's army. People wrote poems and stories about him, and historians liked him because he was very loyal to Mahmud Ghaznavi.
In 1021, Sultan Mahmud Ghaznavi raised Ayaz to kingship, awarding him the throne of Lahore after the Sultan had taken the city following a long siege and a fierce battle in which the city was torched and depopulated. Ayaz became the first Muslim governor of Lahore, where he rebuilt and repopulated the city, adding many significant features, such as a masonry fort, which he built between 1037 and 1040 on the ruins of the previous one that had been demolished in the fighting, along with 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. During his reign, the city became a cultural and academic center, renowned for poetry.
The tomb of Malik Ayaz still stands in the Rang Mahal area of Lahore, although it was destroyed by the Sikhs during their rule of Lahore. The tomb was later rebuilt after the Partition of India.
Malik Ayaz is also celebrated in Sufism, and Amjad Farid Sabri, the slain Qawwal of Pakistan, performed a song dedicated to him, praising his feudalistic loyalty to Mahmud of Ghazni. The song also mentions Ajmer Sharif Dargah and how it attracts female devotees with the same devotion.