1001One World. A Thousand and One Legends.
1001 › Stories › Ali Baba and the Forty Thieves: Origins of the Tale

Behind the legend · 3 min read

Ali Baba and the Forty Thieves: Origins of the Tale

Where Ali Baba and the Forty Thieves comes from, why 'Open Sesame' works, what Morgiana does in the original, and how the 1001 series reimagines it.

By the 1001 team · Updated 2026-11-06

"Open Sesame" may be the most famous password in the world. It comes from Ali Baba and the Forty Thieves, a tale that, like Aladdin, entered the Arabian Nights through Antoine Galland's French translation in the early eighteenth century rather than through any surviving medieval Arabic manuscript.

Another orphan tale

Galland's diary notes that he heard the story of Ali Baba from Hanna Diyab, the young storyteller from Aleppo, in 1709. He published it in the final volumes of Les Mille et une nuits (1717). Later Arabic manuscripts that contain the tale appear to be translations back from Galland's French. Its roots, though, are clearly older and wider: stories of a mountain that opens to a magic word, and of a clever servant who outwits robbers, are found across the Middle East and Europe.

The classic story

Ali Baba is a poor woodcutter. One day in the forest he hides from a band of forty thieves and watches their captain stand before a rock face and say "Open, Sesame!" (افتح يا سمسم). The rock opens. When the thieves leave, Ali Baba repeats the words and finds a cave full of treasure. He takes only a little gold.

His rich, greedy brother Qasim finds out, goes to the cave himself and fills his bags, but in his excitement forgets the password and is trapped. The thieves return and kill him. From that point the hero of the tale is really Morgiana (Marjana), a clever enslaved woman in the household. She arranges Qasim's discreet burial, marks the doors of the whole street so the thieves cannot find the right house, and, when the captain arrives disguised as an oil merchant with his men hidden in jars, pours boiling oil into the jars. At the end she kills the captain while dancing. Ali Baba frees her and she marries his son.

Why "sesame"?

No one knows for certain why the password is sesame. One common theory is that ripe sesame pods burst open by themselves, which makes the seed a natural image for something that opens. Another is that the word simply sounded mysterious to French readers. Whatever its origin, "Open Sesame" has become shorthand for any magic key.

A story about who is really clever

Read closely, the tale is less about treasure than about judgment. Ali Baba is modest and takes little. Qasim is greedy and dies. The thieves are strong but predictable. Morgiana, who has the least power of anyone in the story, has the sharpest mind and saves everyone. It is one of the Nights' great portraits of resourcefulness.

How 1001 retells it

The 1001 series tells Ali Baba in two chapters and makes the story younger and more personal.

In the second chapter the captain arrives as a travelling oil merchant with a train of great clay jars, exactly as in Galland, and it is Marjana who hears breathing where there should only be oil.

Both chapters are available together as Ali Baba: The Complete Tale. The characters, from Ali Baba and Marjana to the thieves' captain, are profiled on the Ali Baba characters page.

More stories