Aladdin is an impoverished young ne'er-do-well in a Chinese town, who is recruited by a sorcerer from the Maghreb, who passes himself off as the brother of Aladdin's late father Qaseem, convincing Aladdin and his mother of his goodwill by apparently making arrangements to set up the lad as a wealthy merchant. The sorcerer's real motive is to persuade young Aladdin to retrieve a wonderful oil lamp from a booby-trapped magic cave of wonder. After the sorcerer attempts to double-cross him, Aladdin finds himself trapped in the cave. Fortunately, Aladdin retains a magic ring lent to him by the sorcerer as protection. When he rubs his hands in despair, he inadvertently rubs the ring, and a jinn, or "genie", appears, who takes him home to his mother. Aladdin is still carrying the lamp, and when his mother tries to clean it, a second, far more powerful genie appears, who is bound to do the bidding of the person holding the lamp.
With the aid of the genie of the lamp, Aladdin becomes rich and powerful and marries Princess Badroulbadour, the Emperor's daughter (after magically foiling her marriage to the vizier's son). The genie builds Aladdin a wonderful palace -- a far more magnificent one than that of the Emperor himself.
The sorcerer returns and is able to get his hands on the lamp by tricking Aladdin's wife, who is unaware of the lamp's importance, by offering to exchange "new lamps for old". He orders the genie of the lamp to take the palace along with all its contents to his home in the Maghreb. Fortunately, Aladdin retains the magic ring and is able to summon the lesser genie. Although the genie of the ring cannot directly undo any of the magic of the genie of the lamp, he is able to transport Aladdin to the Maghreb, and help him recover his wife and the lamp and defeat the sorcerer.
The sorcerer's more powerful and evil brother tries to destroy Aladdin for killing his brother by disguising himself as an old woman known for her healing powers. Badroulbadour falls for his disguise, and commands the "woman" to stay in her palace in case of any illnesses. Aladdin is warned of this danger by the genie of the lamp and slays the imposter. Everyone lives happily ever after, Aladdin eventually succeeding to his father-in-law's throne.