Ali Nur al-Din, the son of a merchant in Cairo, goes to a feast and becomes drunk for the first time and indulges in debauchery. When he returns home, his father is angry with him and they get into a fight which results in Ali losing an eye. With some money from his mother, Ali moves to Alexandria. One day he sees a slave girl, Miriam, being sold; she is allowed to choose her own master and picks Ali. She comes to live with him and every night she sews a girdle for Ali to sell in the market.
However, a Frankish merchant recognizes one of her girdles, and invites Ali and the other merchants to a celebration. They get Ali drunk and he agrees to sell Miriam to the Frank. Miriam is actually the daughter of the Frankish king, and the merchant is her father's royal vizier in disguise. While on pilgrimage, her ship was captured; she converted to Islam and was such a good slave that her master let her choose her next master herself.
Ali goes after her, but his ship is captured by pirates. He along with the other prisoners is presented to the Frankish king, but an old woman asks to have Ali work with her in the church, where he does menial jobs. Princess Miriam recognizes him in the church, and helps him escape through a tunnel with money. Once he gets through the tunnel to the seaside and boards the ship waiting there, the captain is revealed to be Miriam in disguise, and they sail to Alexandria. However, the Franks capture Miriam there and bring her back to France yet again, where the king has promised to marry her to his vizier.
Ali follows her again, gets captured again, and becomes the vizier's slave. He happens to heal one of the king's prized horses and is freed as a reward. Miriam hears him singing, recognizes him, and devises a plan. She drugs the vizier and rides to freedom. Ali is waiting, but falls asleep, so she takes the wrong person along at first. She picks Ali up and they flee the Frankish army, with Miriam fighting soldiers off. The Frankish king writes to Caliph Harun al-Rashid to complain, but the Caliph talks to Ali and Miriam and arranges for their marriage. Ali reconciles with his family.
- The plotline of the merchant's son and the slave girl who chooses her own buyer is identical to Ali Shar and Zumurrud.