# Ali Baba and the Forty Thieves

_Antoine Galland_ · 15 min read · ages 8-12

Ali Baba hears the words that open a rock where forty thieves keep their gold, and the secret soon costs his greedy brother his life. The servant Morgiana kills their captain at her master’s table, and at last Ali Baba rides out to the rock as the last man alive who knows the words.

---

In a town in Persia there once lived two brothers.

Cassim, the elder, had married a rich wife and kept a well stocked shop.

Ali Baba, the younger, had a wife, children and three donkeys, and lived by cutting wood and selling it in the town.

One morning he saw a cloud of dust on the forest road, and out of it rode a troop of armed men.

Robbers, thought Ali Baba, and climbed into a broad tree at the foot of a tall rock, where he could see without being seen.

They stopped below him and got down. He counted them. There were forty.

The tallest of them, whom Ali Baba took for their captain, pushed through the bushes and said:

“Open, Sesame!”

A door swung open in the bare rock. The men went in, the captain last, and the door closed behind them by itself.

After a long while it opened again, and the thieves came out one by one. The captain turned to the rock.

“Shut, Sesame!” he said.

The door closed as though it had never been there, and they rode away the way they had come.

When the forest was quiet, Ali Baba climbed down and stood where the captain had stood.

“Open, Sesame!” he said.

The door flew open.

He had expected a dark hole. Instead he found a great hall lit from above, with silk and carpets and heaps of gold and silver piled along the walls.

He left the silver alone, carried out as many bags of gold as his three donkeys could take, and piled firewood over them so that nothing showed.

“Shut, Sesame!” he said. The rock closed, and he went home.

He drove the donkeys into his yard and emptied the bags before his wife in a shining heap.

“Ali Baba, what have you done?”

“Peace, wife. I am no thief, unless it is thieving to take from thieves.”

He told her the whole of it, and went to dig a hole in the yard.

“Let me measure it first,” said his wife. “I will borrow a measure while you dig.”

She ran to Cassim’s house for one. Her sister-in-law, wondering what grain such poor people could have to measure, smeared a little suet on the bottom of it.

Ali Baba’s wife filled the measure and emptied it, filled it and emptied it, delighted with the count, and took it back with her thanks. She never saw the gold coin stuck underneath.

Cassim’s wife turned the measure over the moment the door closed, and there it was.

“You think you are rich,” she told Cassim that evening. “Your brother is richer. He does not count his money. He measures it.”

Cassim lay awake all night, and before sunrise he was at his brother’s door.

“You play the beggar,” he said, holding out the coin, “and all the while you are measuring gold.”

Ali Baba saw that the secret was out. He told his brother everything, and offered to share the treasure if he would keep quiet.

“Share it I shall,” said Cassim. “But I want the place as well, and the words. Refuse me, and I shall tell the magistrate where your gold came from, and you will lose it all.”

More out of good nature than fear, Ali Baba told him where the rock stood and what to say.

Before daybreak Cassim set out with ten mules and a great chest on each, meaning to have the treasure to himself. He found the rock and the door.

“Open, Sesame!” he said, and the door opened, and shut behind him.

He dragged bag after bag toward it, his head so full of gold that when he came to go out he could not think of the word.

“Open, Barley!” he said.

The door did not move.

“Open, Wheat! Open, Rye! Open, Millet!”

He named every grain he had ever heard of, every grain but the right one, and the rock stayed shut. The harder he hunted for the word, the further it went.

About noon the thieves came back and found ten mules wandering loose with empty chests. They drew their swords, and the captain went to the door.

“Open, Sesame!”

Cassim had heard the horses. As the door swung open he made a rush for the light and knocked the captain down, but the others closed round him, and that was the end of Cassim.

The thieves could not think how anyone had come in without the words. They left him in no state for burial, to frighten anyone else who knew the words, and rode away.

Night came, and Cassim did not. His wife ran in great fear to Ali Baba and told him where he had gone.

At first light Ali Baba took his donkeys to the forest. He saw nothing of his brother on the road, nor of the mules.

“Open, Sesame!” he said at the rock.

The door opened, and inside lay his brother, dead.

Ali Baba forgot every unkindness Cassim had shown him. He laid the body on one donkey, loaded the other two with gold, covered all with firewood, and waited until dark.

He left the gold in his own yard and led the third donkey to his brother’s house, where the door was opened by Morgiana, a servant as quick-witted and brave as any in the town.

“Morgiana, here is your master. He has been killed,” he said quietly. “He must be buried as though he had died in his bed, and nobody must ever guess otherwise.”

Cassim’s widow wept bitterly, and Ali Baba promised her a place under his roof for as long as she lived, if she kept the secret and left the rest to Morgiana.

Morgiana let it be known that her master lay dangerously ill and bought medicines two days running, so the cries of grief that evening surprised nobody.

Before dawn she woke an old cobbler called Baba Mustapha, put two gold pieces into his hand, and led him blindfolded by a long, winding way to the room where the body lay. He stitched what she needed, and was led home the same way.

Cassim was buried with all the usual prayers, and not a soul in the town suspected anything but a quiet death.

A few days later Ali Baba moved his family into his brother’s larger house, and gave Cassim’s shop to his eldest son.

Soon the thieves came back to their cave and found the body gone, and fewer bags of gold than they had left.

“We are discovered,” said the captain, “and lost, unless we learn who knows our secret. One of you must go into the town as a stranger and find out who the dead man was. Whoever goes answers for it with his life.”

One of them offered at once. He came into the town in disguise at daybreak, and the only shop open in the square was the cobbler’s.

“Good morning, old father. How can you see to stitch at your age, and in this light?”

“Old as I am, my eyes are excellent,” said Baba Mustapha. “Would you believe that not long ago I stitched a dead man in a room darker than this one?”

“A dead man! His shroud, you mean, surely.”

“I know what I mean, and you will get no more out of me.”

The thief needed no more. Two gold pieces bought what words could not: blindfolded at his own door, the old man walked the way he had walked before and stopped in front of the very house. The thief marked its door with white chalk.

Not long after, Morgiana came out on an errand and saw the mark. Somebody means mischief here, she thought.

She fetched chalk and made the same mark, in the same place, on four or five doors above and below, and said nothing to anybody.

That evening the thieves came into the town. The thief led the captain to the street, and there he stammered: he had chalked one door and could not tell which.

They went back empty-handed, and the man who had failed paid for it with his life.

A second thief tried with red chalk, and fared no better: by evening five doors wore the same red mark, and he paid the same price as the first.

Then the captain went himself. He made no mark, but walked past the house, and back, and past again, until he could not have mistaken it.

Back in the forest he sent his men round the villages to buy nineteen mules and thirty-eight big leather jars, all empty but one, which was full of oil.

He hid an armed man in each empty jar, left the lids loose so that they could breathe, and rubbed the outsides with oil. At dusk he drove the mules into the town.

Ali Baba was sitting outside his door, taking the cool of the evening.

“Sir, I have brought this oil a long way to sell at tomorrow’s market, and it is late, and I have nowhere to sleep. Would you take me in?”

Ali Baba had seen this man in the forest, but who would look for the captain of forty thieves in a tired oil merchant? He opened his gates and told Morgiana to make ready a bed.

When they had eaten, the guest slipped out to the yard and went from the first jar to the last, saying to each man:

“When I throw pebbles from my window, push the lid off, come out, and I shall be with you.”

Then he came back, and Morgiana lit him to his room.

She had a pot on the fire, for her master had asked for broth in the morning. While she skimmed it her lamp went out, and there was no oil in the house.

“Never mind,” said Abdallah, the other servant. “There are thirty-eight jars of oil standing in the yard.”

Morgiana took the oil jug and went out into the dark. At the first jar, a low voice inside said:

“Is it time?”

Another servant would have screamed and roused the street. Morgiana understood in a breath what her master had let into his house, and answered in the captain’s own manner:

“Not yet, but presently.”

She went down the line, and every jar asked the same question, and every jar got the same answer.

“Not yet, but presently.”

The last jar held oil and nothing else. Morgiana filled her jug and lit her lamp, then filled the biggest kettle in the kitchen from that jar and set it on the fire.

When the oil was boiling she carried it out and poured enough into every jar to make an end of the man inside.

Then she put out the fire and her lamp, and waited at the kitchen window.

A quarter of an hour later the captain woke and opened his window. All was dark and still. He threw down a handful of pebbles and heard them rattle on the jars.

Nothing stirred. He threw again, and a third time. Nothing stirred.

He went down into the yard, smelled hot oil at the first jar, and knew that all was lost. He got away over the garden wall in the dark.

In the morning Ali Baba saw the jars still in the yard and asked why the merchant had not gone to market.

“Look into the first jar,” said Morgiana, “and see if there is oil in it.”

He looked, and started back with a cry.

“Do not be afraid. He cannot hurt you now.”

Then she told him all of it, and the chalk marks as well.

“That merchant is no more a merchant than I am. He is the captain of the thieves of the forest, and he has gone over the garden wall. I cannot say how many are left, so be on your guard.”

Ali Baba gave Morgiana her freedom that hour and promised more, for he owed her his life. The thieves were buried at the end of the garden.

The captain found his cave a dreadful place without his men, and swore he would have Ali Baba’s life himself.

Journey by journey he carried rich cloth out of the cave, until he had enough to open a shop opposite Cassim’s old one, where Ali Baba’s son now sold goods. He called himself Cogia Hassan.

He was well dressed and easy company, and gave the young man presents and dinners until the son told his father that such kindness must be repaid.

“Bring him home on Friday, after your walk,” said Ali Baba. “Morgiana shall have supper ready.”

So on Friday the son stopped his friend at his father’s door and would not let him pass. Ali Baba thanked the guest for his kindness to the boy, and when the guest rose to go, stopped him.

“Will you not stay and eat with us?”

“Forgive me,” said Hassan. “I have a reason. I can eat no meat and no bread that has any salt in it.”

“If that is all, there shall be no salt in anything set before you tonight.”

He went and told Morgiana, who could hardly believe her ears: in that country a man who took salt with you was your friend for life.

She meant to see the stranger for herself, and helped carry up the dishes. One look was enough. Under the fine clothes sat the captain of the forty thieves, and under his coat a dagger.

No wonder he will take no salt with my master, she thought. We shall see about that.

When the fruit and wine had been set out, the servants were expected to leave the three men together. Instead Morgiana dressed herself like a dancer, with a silver-hilted dagger at her girdle.

“Take your tabor, Abdallah, and let us entertain our master and his guest.”

Abdallah played her to the door.

“Come in, Morgiana,” said Ali Baba, “and let our guest see what you can do.”

Abdallah struck up, and Morgiana danced as well as any dancer in Persia. Then she drew the dagger and danced with that, pointing it now at her own heart and now at her master’s, as though it were part of the tune.

At last, out of breath, she snatched the tabor from Abdallah and held it out hollow upward, as dancers do when they ask for a coin. Ali Baba dropped in a gold piece, his son another.

Hassan drew out his purse, and as his hand went into it Morgiana struck with the dagger, and the captain of the forty thieves never rose from the table again.

“Wretched girl!” cried Ali Baba. “What have you done? You have ruined us!”

“I have saved you,” said Morgiana, and opened the dead man’s coat to show the dagger hidden underneath.

“Look at his face, master: here is your oil merchant, and the captain of the forty thieves. He would eat no salt with you. What more do you need?”

“I gave you your freedom, and I promised you more,” said Ali Baba. “You have saved my life twice over. Will you be my son’s wife?”

The son wanted nothing better, and a few days afterwards the wedding was held, with feasting and music. The captain was buried quietly beside his men.

For a whole year Ali Baba went nowhere near the forest, for he could not be sure who else knew the secret. When the year had passed, he rode out to the rock.

“Open, Sesame!” he said.

The door opened. Nothing had been touched since the captain left it, and Ali Baba knew that he was the only man alive who had the secret. He filled a bag with as much gold as his horse could carry and rode home.

In time he took his son to the rock and taught him the words, and his son taught his children after him. They used their fortune quietly and well to the end of their days.

---

- Read online: https://talerie.com/en/tales/ali-baba-and-the-forty-thieves
- Wikidata: https://www.wikidata.org/wiki/Q58190302
- Tale type: ATU 676, ATU 950, ATU 954 (per Wikidata)
- Source: The Blue Fairy Book, ed. Andrew Lang (Project Gutenberg #503), «The Forty Thieves» (https://www.gutenberg.org/ebooks/503)
- Public-domain basis: Talerie contemporary retelling (CC0 2026), based on: The Blue Fairy Book, ed. Andrew Lang (Project Gutenberg #503), «The Forty Thieves» — translation: author died 1715 (+70 passed); translator Andrew Lang (ed.) died 1912 (+70 passed)
- License: CC0-1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
