Sultan Mahmud of Ghazni, who was the first Muslim ruler of the Indian subcontinent, has a relationship with his slave Malik Ayaz. This relationship has become an Islamic legend and Mahmud later appointed Malik Ayaz as the sultan of Lahore.