
Join Djinn Guide: Get 50% Off a Personal Reading
Get new guides to jinn, folklore and occult history. Confirm your subscription to unlock a 50% code for a first personal reading with our partner PuraTarot.
Discover the unseen

Ali Baba and the Forty Thieves explained: the story, Morgiana, 'open sesame', Hanna Diyab and Galland, and why this famous tale is an orphan of the Nights.
Quick answer: Ali Baba and the Forty Thieves is a tale from the Arabian Nights in which a poor woodcutter discovers a robbers' cave that opens to the words 'Open, Sesame', and whose clever slave girl Morgiana defeats the forty thieves. It is one of the 'orphan tales': Antoine Galland heard it from the Syrian storyteller Hanna Diyab in 1709 and published it in French in 1717, but no Arabic manuscript older than Galland's version has ever been found.
Related guides: history of the One Thousand and One Nights, the original Aladdin story, Scheherazade and the frame story, jinn in the Arabian Nights, Sinbad the Sailor's seven voyages, Aladdin's ring and lamp genies.
| Character | Who they are | Role in the story |
|---|---|---|
| Ali Baba | Poor woodcutter | Overhears 'Open, Sesame', takes a modest share of the treasure |
| Cassim (Qasim) | Ali Baba's rich brother | Greedy; forgets the password, is killed and quartered by the thieves |
| Cassim's wife | Borrows scales to measure Ali Baba's gold | Her suspicion starts the trouble |
| Morgiana (Marjana) | Clever slave girl in Cassim's, then Ali Baba's, household | Outwits the thieves three times; the real hero |
| Baba Mustapha | Old tailor | Sews Cassim's body back together, later leads a thief to the house |
| The captain of the thieves | Leader of the band | Disguises himself as an oil merchant, then as the merchant Cogia Houssain |
| Ali Baba's son | Young merchant | Befriends the disguised captain; marries Morgiana at the end |
Key Takeaways
Ali Baba is a poor woodcutter in a Persian town who, while gathering wood in the forest, sees forty horsemen ride up to a rock face. Their captain calls ‘Open, Sesame’, the rock opens, and the band carries its loot inside; ‘Shut, Sesame’ closes it again. When they leave, Ali Baba tries the words, enters a cave piled with silk, gold and silver, and takes home as much gold as his donkeys can carry. His wife borrows a measuring scale from the wife of his rich brother Cassim to weigh the coins; Cassim’s wife, suspicious, smears the scale with fat, and a gold piece sticks to it.
Cassim forces the secret from his brother and goes to the cave alone. Dazzled by the treasure, he forgets the password. The thieves return, kill him and cut his body in four pieces to hang inside the cave as a warning. Ali Baba recovers the body, and Cassim’s slave girl Morgiana arranges a secret burial, paying a blindfolded tailor, Baba Mustapha, to sew the corpse together so Cassim can be buried as if he died naturally.
The rest of the tale is a duel of wits between the thieves and Morgiana. Spies mark the door with chalk; Morgiana marks every door in the street. The captain comes disguised as an oil merchant with thirty-seven men hidden in jars; Morgiana kills them with boiling oil and later, when the captain returns as the merchant Cogia Houssain, stabs him during a dagger dance. Ali Baba frees her and marries her to his son. The tale’s place within the larger collection is discussed in our history of the One Thousand and One Nights.
Ali Baba is one of the most famous stories in the Arabian Nights, yet it is not in any of the Arabic manuscripts that the collection is based on. It belongs to a group scholars call the ‘orphan tales’, along with Aladdin, Prince Ahmed and the Fairy Peri Banu, and the Ebony Horse, which first appear in Antoine Galland’s French Les mille et une nuits (1704–1717) and nowhere earlier.
Galland’s diary explains how. In 1709, having run out of material from his Syrian manuscript, he met Hanna Diyab, a young Maronite Christian from Aleppo who had come to Paris in the retinue of the traveler Paul Lucas. Over several months Diyab told Galland more than a dozen stories, which Galland summarized in his diary and later expanded. Ali Baba appeared in volume 11, published in 1717, two years after Galland’s death.
Diyab was long a footnote, but in 1993 his own travel memoir, written in Arabic in 1763, was identified in the Vatican Library. Published in English in 2021 as The Book of Travels, it describes his journey to Paris and his meeting with Galland, though it does not retell the tales. Scholars such as Paulo Lemos Horta now argue that Diyab should be regarded as a co-author of Ali Baba and Aladdin. The parallel case is treated in our account of the original Aladdin story.
Does this touch your own situation? Many readers come to these pages because something in their home, dreams or family feels unexplained. Reading history helps, but it cannot look at your specific case.
Consult the Sheikh Private, confidential, and free to ask.
For a few decades it seemed the Arabic Ali Baba had been found. In 1910 the American orientalist Duncan Black Macdonald published an Arabic text of the tale from a manuscript in the Bodleian Library at Oxford, and argued that it preserved the story as Galland had heard it. Later analysis by Muhsin Mahdi, the editor of the critical Arabic edition of the Nights, showed that the manuscript was written in the nineteenth century by Jean Varsy, a Frenchman living in Egypt, and that its Arabic was a translation back from Galland’s French. The ‘original’ was a copy of the copy.
This does not mean the tale is purely French. Folklorists classify it as an international tale type (ATU 676, ‘Open Sesame’), and versions of a treasure cave opened by a magic word are found across the Middle East, Central Asia and Europe. Diyab, a storyteller steeped in Aleppo’s oral culture, almost certainly drew on such material. What cannot be recovered is the exact form he told, since Galland’s diary gives only a summary.
Later translators had to decide what to do with a story with no Arabic text. Edward Lane omitted it; Richard Burton included it in his 1885–1888 edition, translating from Galland and from a manuscript he believed to be Arabic; Mahdi’s 1984 Arabic edition and Husain Haddawy’s English translation of it leave the orphan tales out entirely. How the frame story shapes which tales are ‘inside’ the Nights is covered in Scheherazade and the frame story.
Readers remember Ali Baba as the hero, but after the first scene he is passive and leaves every decision to Morgiana. She is introduced as Cassim’s slave girl, ‘intelligent, clever and resourceful’, and the story is built around four demonstrations of those qualities.
Her reward, freedom and marriage to Ali Baba’s son, has struck modern readers as a tidy patriarchal ending, but in the story’s own terms it is the highest honor the household can give. Several modern retellings make her the title character; Arabic versions call her Marjana, ‘coral’.
The password is one of the few phrases from the Nights that everyone knows, in English, French (Sésame, ouvre-toi) and the German of the Grimms, who used it in their own tale ‘Simeli Mountain’. In Galland the words are Sésame, ouvre-toi, and Cassim’s fatal error is to substitute other grains: he tries barley and wheat before the thieves find him.
Why sesame? The most common explanation is botanical: sesame pods burst open with a pop when the seeds ripen, which makes ‘open like a sesame pod’ a natural image for a door springing apart. Other proposals, such as a corrupted Persian phrase, are no better than guesses. Diyab or Galland may simply have chosen a familiar, slightly comic word for a secret a greedy man could forget.
The phrase has a life of its own. ‘Open sesame’ now means any key that gives instant access, and the cave is the reason Jack Ma named his company Alibaba in 1999, saying he wanted a word that people everywhere recognized and that evoked treasure revealed. There is no jinn in Ali Baba, incidentally, which distinguishes it from Aladdin and the Fisherman; the only magic is the word. Readers looking for the collection’s supernatural tales can start with jinn in the Arabian Nights.
The first is that Ali Baba is a thief. He is not; he is a woodcutter who takes gold from thieves, and the title’s grammar, ‘Ali Baba and the Forty Thieves’, has led generations of readers to assume he led the band. In Galland he is honest, cautious and rather dull.
The second is that the tale is ancient Arabic folklore recorded by Scheherazade. As explained above, it entered the Nights in Paris in 1717 and may owe as much to a Syrian Christian storyteller and a French scholar as to any Arabic manuscript. The third is the number forty: the band shrinks steadily, since the captain kills two scouts and Morgiana kills thirty-seven in the jars, so that by the dagger dance only the captain is left. Forty is a conventional ‘many’ in Middle Eastern storytelling.
The fourth is that ‘Ali Baba’ is a surname. ‘Baba’ means father and is an honorific; ‘Ali Baba’ is roughly ‘old man Ali’, a form Diyab would have used naturally in Aleppo. Finally, the story is set in Persia, not Baghdad or Arabia, and nothing in it depends on Islamic law or belief; it is a tale of wits, greed and loyalty that could be set almost anywhere.
Ali Baba has been adapted constantly since the eighteenth century. It was a favorite of English pantomime from the Victorian era, which is where the comic version of Ali Baba as a bumbling hero and the ‘forty thieves’ as a chorus line come from. Universal’s 1944 film with Jon Hall and Maria Montez made it a swashbuckler, Fernandel played a comic Ali Baba in 1954, and Popeye met the forty thieves in a 1937 cartoon.
Twentieth and twenty-first century retellings often promote Morgiana, give the thieves political motives, or relocate the story. The treasure cave with a password has become a stock device in video games, and ‘open sesame’ appears in software, security jokes and advertising. The Alibaba Group’s name is the most visible modern trace.
Among the Nights’ stories, Ali Baba and Aladdin are the two that non-specialists know best, which is a historical irony: both are orphan tales, told by Hanna Diyab, written by Galland, and absent from the Arabic manuscripts. The collection’s reputation in the West rests to a surprising degree on two stories that an Aleppan traveler told a French scholar in 1709.
Read Galland’s version first, in English in the anonymous ‘Grub Street’ translation or in a modern rendering, since it is the source of every later text. Then compare Burton’s 1885 translation, which is longer, more ornate and adds detail he claimed came from Arabic. Check any edition’s preface to see whether it includes the orphan tales and on what basis; a good edition will say.
For the history, Galland’s diary entries on Diyab and Diyab’s own Book of Travels are available in translation, and Mahdi’s introduction to his Arabic edition explains the Varsy forgery. Read this way, a children’s tale becomes a case study in how the Nights were made: a collection assembled over centuries by many hands, in which some of the most beloved pieces are the newest.
Still have a question about your own experience? Describe what you are seeing, feeling or dreaming, and when it started. The Sheikh reads every message personally and replies in private.
Drawn to these stories for a reason? Tales like Ali Baba endure because they speak to luck, trust and the doors we choose to open, and our partner PuraTarot offers a Full Personal Reading if you would like a personal perspective on a question in your own life. Join the free Djinn Guide newsletter and, once you confirm, you will unlock a 50% code for your first reading.
Further reading
As an Amazon Associate we earn from qualifying purchases.
A poor woodcutter, Ali Baba, learns the password 'Open, Sesame' to a cave where forty thieves keep their loot. His greedy brother Cassim forgets the words and is killed. The thieves hunt Ali Baba, but his clever slave girl Morgiana outwits them, killing thirty-seven in oil jars and stabbing the captain during a dance.
Only partly. It appears in Galland's French edition of 1717 but in no earlier Arabic manuscript, which makes it an 'orphan tale' like Aladdin. Galland heard it from the Syrian storyteller Hanna Diyab in 1709. A supposed Arabic original published in 1910 proved to be a nineteenth-century back-translation from the French.
'Open, Sesame' is the password that opens the thieves' cave. The usual explanation is that ripe sesame pods burst open suddenly, making the plant a natural image for a door springing apart, though the phrase's origin is not certain. Today 'open sesame' means any key that grants instant access.
Morgiana (Arabic Marjana) is the intelligent slave girl who saves Ali Baba. She arranges Cassim's secret burial, defeats the chalk-mark trick, kills the thieves hidden in oil jars and stabs their captain during a dagger dance. Ali Baba frees her and marries her to his son. Many critics regard her as the tale's true hero.
Hanna Diyab was a Maronite Christian from Aleppo who traveled to Paris in 1708–1709 and told Antoine Galland the stories of Aladdin, Ali Baba and others. His own Arabic travel memoir, written in 1763 and rediscovered in the Vatican Library in 1993, was published in English in 2021 as The Book of Travels.
Disclaimer
This article discusses Ali Baba and the Forty Thieves as a work of literature and folklore. The views summarized reflect current scholarship and may be revised as research on the Nights continues.
Did this guide help you understand the subject? Rate it and share your honest opinion to help other readers. Every review is checked by our editors before it appears.
There are no reviews yet. Be the first one to write one.
Sheikh Youssef
Tayeb El Merzouki
For inquiries about personalized spiritual work, private rituals, and traditional talismans, connect directly with Sheikh Youssef Tayeb El Merzouki.
Chat on WhatsApp