In a town in Persia there dwelt two brothers, one named Cassim, the other Ali Baba. Cassim was married to a rich wife and lived in plenty, while Ali Baba had to maintain his wife and children by cutting wood in a neighbouring forest and selling it in the town.
One day, when Ali Baba was in the forest, he saw a troop of men on horseback, coming toward him in a cloud of dust. He was afraid they were robbers, and climbed into a tree for safety. When they came up to him and dismounted, he counted forty of them. They unbridled their horses and tied them to trees.
The finest man among them, whom Ali Baba took to be their captain, went a little way among some bushes, and said, “Open, Sesame!” so plainly that Ali Baba heard him.
A door opened in the rocks, and having made the troop go in, he followed them, and the door shut again of itself. They stayed some time inside, and Ali Baba, fearing they might come out and catch him, was forced to sit patiently in the tree. At last the door opened again, and the Forty Thieves came out. As the Captain went in last he came out first, and made them all pass by him; he then closed the door, saying, “Shut, Sesame!”