Kasim and Ali Baba are brothers. One day Ali Baba finds out about a cave which belongs to a band of robbers. When he tells his brother, Kasim, he goes to the cave as well. He is found out and killed by the robbers. Ali Baba finds his brother and takes him home with his asses full of gold. Kasim is buried in secret, a tailor is blindfolded and got to the house where he sews to body. The thieves find Kasim gone with a lot of gold so they are sure there is another person who knows about their secret. One thief finds the house through the tailor. He marks the house with white chalk. Morgiana, a slave-girl of Ali Baba, notices this and chalks every door. A second thief tries with red chalk, but Morgiana finds out and chalks every door with red chalk. The third thief remembers the way. The Captain will come with mules with jars of oil and thieves in others. He is invited in Ali Baba’s house. Morgiana finds out about the plot and kills the robbers by putting boiling oil in their jars. Only the Captain knows to escape. The Captain tries again by opening a shop and to get invited, in disguise, by Ali Baba’s nephew. However, again Morgiana finds out about him and stabs him to death. Morgiana is married to Ali Baba’s nephew and he and his family become rich.
In a certain town of Perdia there lived two brothers: Kasim and Ali Baba. When their father died they equally divided the little inheritance. The elder took a wife with a rich father, but the wife of Ali Baba was poor. One day Ali Baba had cut dead branches and placed the loads on his beasts when suddenly he saw a troop if horsemen coming towards him. He quickly hides in a tree next to a rock. The horsemen come close to the rock face and dismount. Here the captain says “open, O Simsim!” and a wide doorway appears. The robbers enter and it takes some time before they return. When they leave the captain says “shut, O Simsim!” and the doorway closes. When the robbers are gone Ali Baba rehearses the words and enters the cave. Inside is a huge treasure and Ali Baba loads a lot of it on his animals and leaves the cave.
When Ali Baba has returned to his wife she thinks he is a robber but he convinces her he is not. They want to weigh the gold so Ali’s wife goes to Kasim’s wife. She doesn’t want to tell her for what she will use the scales, so Kasim’s wife smears wax on the scales. When the treasure is weighed and buried and scales are brought back, Kasim’s wife finds out they have been weighing Ashrafis. She tells Kasim and he goes to his brother. Ali Baba tells his secret to Kasim. Upon hearing this Kasim goes to the cave. He says the words to open the cave, but when he is inside and the door closes he forgets how to open it again. When the robbers find Kasim in their cavern they kill him and hang him in pieces on the walls as a warning.
Kasim’s wife grows weary and informs Ali Baba of her husband not returned home. Ali Baba goes to the cavern and finds his brother. He takes his brother to his home with his asses full of gold. Ali Baba knows that his brother’s death must remain a secret and Kasim’s wife swears she will keep the affair concealed. Morgiana, a slave-girl, first buys drugs to keep a man alive. She tells the druggist that Kasim is very ill. The next day Morgiana goes to a tailor, Baba Mustafa, to make shrouds and cereclothes. She blindfolds the tailor when he goes to the house of Kasim. and gives him a gold coin. The tailor sews the parts of the body back together and then a shroud. Kasim is then buried. Ali Baba stays forty days in the house for mourning and after that he marries Kasim’s wife. His nephew takes over the shop of Kasim.
One day as the robbers re-enter their cave, they find Kasim gone with a lot of gold. They know for sure that another person knows their secret and that they must deal with this before their cave will be empty. One thief volunteers to go to town and find out who’s behind this. He finally comes to the tailor, pays him money to tell him the secret. He blindfolds the tailor to bring him to the house of Kasim. When they arrive he marks the house with white chalk. When Morgiana returns home, she sees the white chalk on their door and fear mischief. She chalks all the other doors of the quarter to make sure their home isn’t found by the thieves. The robbers come to the quarter where the thief chalked the house, but they can’t find the right door, because all the doors are chalked.
A second robber goes to the tailor and finally comes to the house of Kasim. He uses red chalk to mark the house, but again Morgiana foresees the plot and chalk the other doors with red. The captain puts the robber, like the first one, into goal. A third robber eventually comes to the door of Kasim and remembers it by heart, “the tablet of his heart”. The plan is to come into town as an oil-merchant. The captain comes with thirty-seven mules with two jars each. One for oil, the other for a robber. When the captain comes to the door of Kasim, he asks to stay for the night, something Ali Baba consents to. At night the Captain goes to his mules to feed them and give the final instructions to his men.
Morgiana wants to have more oil for the lamps and the slave boy Abdullah reminds her of the jars with oil. When she gets to the jars she hears a voice: “Is it now time for us to sally forth?” Morgiana understands the plot and says in a low voice: “Not yet.” She then boils oil and pours is in every jar with a robber. No one in the house hears a sound. An hour later the Captain comes to the jars but finds all his men dead. He escapes through the garden over the wall.
When Ali Baba finds out about the robbers in the jars, Morgiana tells him to be quiet for otherwise the neighbours would find out. She tells him the full story including about the chalk on the doors. They count thirty-seven thieves, so three remain including their Captain. They bury the bodies in the garden and Ali Baba remains cautious. The Captain on the other hand wants to wreak his vengeance, and do it on his own. So he hires a shop where he sells the finest stuffs. He calls himself Khwajah Hasan and soon forms acquaintance with his fellow-shopkeepers and especially towards the son of Kasim. Ali Baba’s nephew invites Khwajah Hasan to his uncle’s place as his own is too small. At Ali Baba’s place the Captain says he doesn’t eat salt and Ali Baba tells his slave-girl Morgiana to put no salt on the food. Morgiana is amazed by this. She helps Abdullah in preparing the table and recognizes the Captain. At dessert Kwajah Hasan sees his opportunity to kill Ali Baba, but he waits until the slave-boy and girl are finished. Morgiana does a dance and stabs the Captain suddenly. At first Ali Baba is dismayed but after finding the dagger with the Captain rejoices. He proposes his nephew to marry Morgiana which he consents to.
One morning Ali Baba goes to the cave again and finds it untouched. From this he concludes all the thieves are dead. He teaches his sons and his sons’ sons how to open the cave. Thus Ali Baba and his household live their lives in wealth and he rises to high degree and dignities.