Alibaba, a poor man, lives in the fictional town of Gulabad, somewhere in Central Asia, with his mother and elder brother Qasim, who owns a small shop. Ali's father, Yousuf, is a merchant in a distant land and has not returned to Gulabad since leaving shortly after Ali's birth. Ali earns his living by selling timber he cuts from the hills. Gulabad is terrorized by a band of 40
bandits who hide their loot in a magical cave located in the deserted hills. The bandit leader uses a magical spell to open the cave and another to close it. When news reaches Ali that his father has gone missing, he sets out to find him. During his journey, Ali not only locates his father but also rescues Princess Marjeena from the guards of a usurper who murdered her father to seize the throne. Ali and Marjeena fall in love, but their happiness is short-lived. They are ambushed, Marjeena is captured, and Yousuf is killed. After burying his father, Ali learns that Marjeena is being sold in the slave market. He borrows money from Qasim to buy her freedom and brings her home. However, Qasim demands repayment and decides to evict Ali and their mother when the debt is not returned. Forced to leave, Ali and his mother start anew. Meanwhile, the
Qazi of the region announces a reward for the capture of the notorious bandit Abu Hassan. Fatima, a young girl whose father was murdered by the dacoits, seeks vengeance and offers to help Ali defeat Abu Hassan. Soon, Ali discovers Abu Hassan’s secret hideout and learns the magic spells to access it. He takes some gold and jewelry from the cave, which he distributes among the villagers to fund a water diversion project for their parched land. Qasim, driven by greed, persuades Ali to reveal the cave's location and the spells. After gaining this knowledge, Qasim visits the cave but becomes trapped when he forgets the spell to reopen the door. When the dacoits find him, they kill him. Ali informs the Qazi about Abu Hassan’s hideout, unaware that the Qazi and Abu Hassan are the same person. The Qazi instructs his men to kill Ali to protect the treasure. Abu Hassan devises a plan to hide the forty thieves in large urns, intending to ambush Ali. However, Ali discovers the plot with Fatima's help and kills all the thieves. In the end, Ali exposes the truth about Abu Hassan’s dual identity and brings justice to Gulabad. == Cast ==