Ala ud-Din was trapped in a cave by his uncle, the Vizier. Ala ud-Din was rescued by what he thought was a djinni but was really the Fourth Doctor. They defeated the Vizier so that Ala ud-Din could marry his love Badroulbadour. (PROSE: The Nobility of Faith)