Ali Baba and the Forty Thieves
Ali Baba, a poor woodcutter, happens to overhear a group of thieves - forty in all - visiting their treasure store in the forest where he is cutting wood. The thieves' treasure is in a cave, the mouth of which is sealed by magic - it opens on the words "Open, Sesame", and seals itself on the words "Close, Sesame". When the thieves are gone, Ali Baba enters the cave himself, and takes some of the treasure home.
Ali Baba's rich brother, Cassim, finds out about his brother's unexpected wealth, and Ali Baba tells Cassim about the cave. Cassim goes to the cave to take more of the treasure, but in his greed and excitement over the treasures forgets the magic words to get back out of the cave. The thieves find him there, and kill him. When his brother does not come back, Ali Baba goes to the cave to look for him, and finds the body, bringing it home. With the help of Morgiana, a clever slave-girl in Cassim's household, they are able to give Cassim a proper burial without arousing any suspicions about his death.
The thieves, finding the body gone, realize that somebody else must know their secret, and set out to track him down. The first several times they are foiled by Morgiana, who is now a member of Ali Baba's household, but eventually they are able to ascertain the location of Ali Baba's house.
The lead thief pretends to be an oil merchant in need of Ali Baba's hospitality, bringing with him mules loaded with forty oil jars, one filled with oil, the other thirty-seven with the other thieves (the two missing members were the scouts previously sent to find the house, who were killed for their failure). Once Ali Baba is asleep, the thieves plan to kill him. Again, Morgiana discovers and foils the plan, killing the thirty-seven thieves in their oil jars by pouring boiling oil on them. When their leader comes to rouse his men, he discovers that they are dead, and escapes.
To exact revenge, after some time the lead thief establishes himself as a merchant, befriends Ali Baba's son (who is now in charge of the late Cassim's business), and is invited to dinner at Ali Baba's house. The thief is recognised by Morgiana, who performs a dance with a dagger for the diners and plunges it into the heart of the thief when he is off his guard. Ali Baba gives Morgiana her freedom and she marries his son. Thus, the story ends happily for everyone except the forty thieves and Cassim.
The story has its base in a Sudanese saga of king Ali Baba of the Bija tribe (inhabited near Port Sudan). The king refused to pay the taxes to Al-Mutawakkil, the tenth Abbassi caliph in Baghdad. The rebel king sealed all gold mines in the mountains and stopped central officials from going to the whole Red Sea area. Baghdad did send its army in to keep its power upon the vital gold market in the Islamic world (it's believed that Sudan provided more than sixty percent of the Abbassi gold in the pre-crusade era) and within five years it managed to crush the rebellion. Ali Baba, taken to Baghdad, carried all the gold hidden by his men to the caliph. A public display of the great treasure and the defeated king was shown in all important cities in the road to the capital Samarra creating the legend of the caves and the legend of the thieves. In the end, Ali Baba was granted amnesty in Samarra and upon his return he gave gold to the needy in all major towns in the road as a good gesture to the muslims whom he fought.