A Summary and Analysis of ‘Ali Baba and the Forty Thieves’

By Dr Oliver Tearle (Loughborough University)

The story of Ali Baba and the Forty Thieves is, after the tale of Aladdin and the Magic Lamp (which we have analysed here), the best-known of the Arabian Nights stories. The words ‘Open, Sesame!’ are famous even to people who have never read the story of the crafty thief and his adventures. But there are a number of curious details about this story which are less well-known.

Before we get to those, though, and before we offer some words of analysis about this tale full of excitement and suspense, it might be worth recapping the plot.

Ali Baba and the Forty Thieves: plot summary

There were once two brothers living in Persia. Their names were Ali Baba and Kasim. When their father died, they quickly spent all of the money they inherited from him, but Kasim married a fairly wealthy woman, and was able to set himself up as a reasonably successful merchant. Ali Baba, meanwhile, married a poor woman and made a living by selling firewood, although he was much poorer than Kasim.

One day, Ali Baba is in the forest gathering wood when he sees some riders coming to a cave. They pronounce the words ‘Open, Sesame!’ and a doorway opens in the side of the rock, and the men – whom Ali Baba realises are a group of forty thieves – go inside.

When they have left, Ali Baba tries saying the words ‘Open, Sesame!’, and sure enough, a portal opens up in the cave, and he walks inside to find it full of carpets, silks, and coins. These men are clearly thieves who use the cave to store their treasure that they have stolen.

Ali Baba takes some of the coins from the cave, remembering to utter the magic password, ‘Open, Sesame!’ so he can escape the cave, and then ‘Close, Sesame!’ so the portal seals up behind him when he’s out. He then takes his donkeys back home, laden with the coins he’s taken from the cave.

Ali Baba tells his wife about what he found, and they agree to keep the coins – and the cave – a secret. But his wife wants to weigh the coins, so she goes and borrows some scales from Kasim, Ali Baba’s brother.

Kasim’s wife, wondering what her sister-in-law could want with some scales, smears some tallow on the bottom in the hope that some of the items will be accidentally stuck to the scales when they’re returned.

Sure enough, when the scales are returned to her, one of the coins has stuck to the scales, and Kasim’s wife tells her husband that Ali Baba clearly has lots of coins he’s acquired from somewhere.

When Kasim confronts Ali Baba and threatens to tell the police about the coins if his brother doesn’t tell him everything, he tells him all about it, and Kasim rides out to the cave, remembering the magic words his brother told him about.

However, so overwhelmed is Kasim by all the treasure inside the cave, that he forgets the password, ‘Open, Sesame!’, and cannot escape the cave. When the forty thieves ride to the cave to drop off their latest spoils, they discover Kasim inside, and kill him, chopping his body into four pieces.

They leave these four pieces hanging inside the cave, in case anyone else has discovered the cave and thinks they can steal things from it. They clearly have no time for people stealing from them. (Oh, the irony!)

When Kasim doesn’t return home, his wife gets worried, and asks Ali Baba to go looking for him. Ali Baba has a feeling his brother has gone to the cave in the forest, and sure enough, when he gets there he discovers his brother’s body in pieces.

Taking it home, he gives the pieces to Kasim’s widow, who sends for a tailor, Baba Mustafa, who is adept at sewing things together. Ali Baba takes his brother’s widow in as his wife. At Ali Baba’s house, the tailor sews up Kasim’s body ready for burial.

Meanwhile, the forty thieves have returned to their cave and discovered that both the body and more of their treasure have gone. They decide they must find who’s responsible and stop them. So the chief sends one of the thieves into town to track down the guilty man.

The thief happens to call upon the tailor who had sewn Kasim’s body back together. When the thief pays him, the merchant takes him to the house where he sewed up the dead body. Marking the door of Ali Baba’s house with white chalk so he can find it again, the thief then returns to the forest.

However, Ali Baba’s clever and sharp-witted servant, a girl named Morgiana, spots the white chalk mark and suspects something’s going on. So she goes and marks all of the neighbouring doors with similar white chalk marks. Sure enough, when the thieves turn up to sneak into Ali Baba’s house and kill him, they cannot work out which house is his, since all houses in the area bear the same chalk mark!

A second thief tries his luck, doing the same thing as the first one, but this time marking the door with red chalk. But Morgiana once again spots the mark soon afterwards, and duly marks all the other houses with red chalk. When the thieves turn up, they are thwarted again.


The chief imprisons the two thieves who failed in their missions, shutting them up in the cave. (Note: this is a very stupid idea, since they are locked in there with all of the treasure, and know the password that will open the portal, so if they’d wanted to mutiny, they could have made off with all the treasure they could carry as soon as the other thieves had gone.)

The chief hatches his own plan: once he has paid Baba Mustafa to lead him to the correct house, he memorises its location, rather than marking it with chalk. He then takes the 37 thieves (the other two are imprisoned in the cave) and goes to Ali Baba’s house, where, disguised in foreign clothes, the chief pretends to be a merchant from another country who is selling oil in the city.

Can he spend the night in Ali Baba’s garden, and store his jars of oil in his shed? The jars are, of course, where the other thieves are lying in wait, ready to come out and join the attack on Ali Baba’s house.

Ali Baba agrees, and asks Morgiana to make some food for their guest. The chief decides to have a nap in the garden. When Morgiana runs out of oil, she goes out into the shed to get some – only to discover the thieves hidden in the oil jars. They assume she is their chief, however, and ask ‘Is it time to act yet?’ The quick-thinking servant imitates the chief’s voice, telling them to wait as the time to act hasn’t arrived yet.

She locates a jar that actually does contain oil, and goes back into the house. Heating it up until it’s boiling hot, she then takes the oil out to the shed – and pours it into each and every one of the jars in which the thieves are concealed. They all burn to death. She then locks the gate so the sleeping chief cannot escape.

Morgiana tells Ali Baba about the thieves, and how she has saved him from them. He is grateful to her. While they are inside, the chief wakes up and discovers all of the thieves dead, so he flees over the garden fence.

The chief hatches another plan which involves playing a longer game. Disguised once more, he sets up a market stall in the bazaar, using an assumed name, and trades there, opposite Kasim’s orphaned son, Ali Baba’s nephew. He befriends the young man and, over time, the nephew invites the robber captain to Ali Baba’s house for a meal, as his guest.

When Morgiana recognises the robber chief, and spots the dagger he has concealed under his robes, she dresses up as an exotic dancer, complete with a dagger of her own, and asks her master if she can dance for them both. Ali Baba agrees, and while she is walking around the table to collect coins from the men, she suddenly brings out her dagger and stabs the chief, killing him.

When she tells Ali Baba that this man was the same one that came to his house to kill him before, posing as an oil merchant, and she reveals the dagger the man had concealed beneath his robes, Ali Baba rewards her by giving her his nephew’s hand in marriage. Ali Baba grows very rich, thanks to all of the treasure in the cave, and – in true fairy-tale fashion – they all live happily ever after.

Ali Baba and the Forty Thieves: analysis

Although it’s one of the most famous tales collected under the title Arabian Nights (or 1,001 Nights), the tale of Ali Baba and the Forty Thieves was not originally part of the collection at all.

Instead, Ali Baba, Aladdin, and Sinbad the Sailor were all ‘orphan tales’ added in the eighteenth century by a French translator, Antoine Galland. As we discuss in more detail in a separate post about Aladdin, this means that the three most famous stories from the Arabian Nights weren’t part of the original collection.

Indeed, it was Galland who gave us the most famous expression associated with ‘Ali Baba and the Forty Thieves’: ‘Open, Sesame’. Or rather, Galland’s original French was Sésame, ouvre-toi, which literally translates as ‘Sesame, open yourself’. However, ‘Open, Sesame’ (remember the comma) is how the phrase is usually rendered in English.

And although ‘Sesame’ here probably refers to the plant or seed of that name – when Kasim forgets this Ur-password while he’s in the treasure cave, he tries a number of other plant names – there is a theory that it is meant to be a reduplication of the Hebrew šem (‘name’, specifically the name of God). But this theory seems less persuasive than the idea that the magic words refer to the idea of opening up a sesame seed pod that releases the ‘treasure’ within the pod.

What’s more, although the tale is traditionally known by the title of ‘Ali Baba and the Forty Thieves’, the character who demonstrates the real cunning and cleverness is not Ali Baba but his servant girl, Morgiana, whose quick thinking and wise actions save her master not once but twice.

Of course, as in many European fairy tales, Morgiana is rewarded with her freedom and a socially advantageous marriage to Ali Baba’s own nephew: she is free from a life of servitude and goes on to prosper as the wife of a rich man.

In this way, Morgiana’s sly cunning mirror Scheherazade’s: she, too, wins her freedom through telling this tale to her master, among many other tales. It’s as if Scheherazade is subtly hinting that good masters reward their female servants by granting them freedom and prosperity – as her own master should do when she has finished entertaining him with her stories.

But Morgiana isn’t the only quick-thinking female character: Kasim’s wife, too, hatches the plan with the tallow on the scales which leads to her discovering Ali Baba’s bags of coins. Ali Baba does steal from other thieves, but that nevertheless renders him a thief himself, rather than an honest man. Morgiana, however, despite committing murder, does so out of loyalty to her master, and she is rewarded with a husband and her freedom.


  1. Pingback: A Summary and Analysis of Hans Christian Andersen’s ‘The Tinder Box’ Fairy Tale – Interesting Literature

  2. How interesting! As a child growing up in India, this story was my favorite in my thick book of the Arabian Nights. I used to love the revenge of Morgiana as she poured hot oil into the jars! Cruel.
    But what did I know? I was only 11. Great analysis!

  3. An early translator of the Arabian Nights was the Victorian polymath Sir Richard Burton – did anyone live a more action-packed life in the whole of history than Burton ? my hero !

  4. I rather like the suggestion that ‘Open Sesame’ could be a mildly rude joke. Sesame oil is thought to be a laxative.

    • Yes, that’s a nice idea! And other tales in the Arabian Nights certain feature scatalogical and other rude elements. Makes one wonder what the ‘treasures’ inside the cave are meant to represent…