After many years of prayer, the Sultan of Basra has a son. Astrologers predict that the child, Zayn al-Asnam, will experience danger but if he survives, will become a wealthy ruler. After his father's death, Zayn al-Asnam wastes his inheritance and neglects his duties, until the people revolt and he narrowly escapes death. In a dream, a sheikh tells the repentant prince to go to Egypt. A second dream tells him to go home, but the dreams direct him to a hidden chamber in the palace, where he finds eight statues made of precious stones. He also finds a key and a message saying to visit Mubarak, a slave in Cairo. This slave takes him across a lake with a jinni ferryman to a paradise island, where he meets the king of the jinn. The king tells him that he will give him the ninth statue in return for a beautiful fifteen-year-old virgin. Zayn finds the daughter of the vizier of Baghdad, but marries her himself, so she is no longer a virgin. However, the king of the jinn forgives his broken promise.