->"Open sesame!"

'''"Ali Baba and the Forty Thieves"''' is a story from the ''Literature/ArabianNights''.

Ali Baba, a poor woodcutter, stumbles on the treasure cave of a band of robbers, which is magically sealed and must be opened by speaking the words "Open Sesame". He takes some of the treasure from the cave and becomes rich. His brother Kasim, a wealthy merchant, finds out Ali Baba suddenly had money, and learns how to get to the cave. Cassim is discovered by the robbers when he forgets the magic word to open the door, and is killed and his body cut into quarters and hung up at the entrance to the cave to warn others. Ali Baba comes to the cave, finds his brother's body, and retrieves it. The robbers discover the body is missing and come in search of whoever removed it. Their attempts to identify Ali Baba and then to kill him are repeatedly foiled by the clever slave-girl Morgiana, and all the thieves wind up dead. Morgiana marries Ali Baba's son, Ali Baba marries Kasim's wife, and the family lives happily ever after.

Although the story is best-known as part of the Arabian Nights, and is one of the best-known stories from the Arabian Nights, it appears to be a late ring-in. The earliest existing written version is in the first European translation of the ''Arabian Nights'', published in the 18th century by Antoine Galland, and it's thought that he included the tale from a separate source.
!!This story provides examples of:
* BlindfoldedTrip: Morgiana does this with Baba Mustafa the tailor, leading him to Kasim's house so Mustafa can stitch Kasim's body back together. This precaution fails when one of the bandits does the same--he blindfolds Mustafa, who uses muscle memory to successfully lead the bandit to Kasim's house.
* CanonImmigrant: As noted above, this tale was not included in any of the ancient manuscripts that make up the ''Arabian Nights'' and in fact there is no source for it before Antoine Galland included it in his early 18th-century translation of the ''Arabian Nights'' into French.
* CharacterNameAndTheNounPhrase
* DeadGuyOnDisplay: Poor Kasim, chopped up in quarters and hung outside the door to the cave as a warning.
* DecoyProtagonist: Ali Baba is the protagonist at first, but he pretty much stops being such after he recovers Kasim's body; at that point, the role is taken over by Morgiana, with Ali Baba now a supporting character.
* DesertBandits: The 40 thieves rob caravans then place the bounty in their magic cave.
* FamilyUnfriendlyDeath: In order to infiltrate Ali-Baba's house the chief bandid hides his men in large jugs that his "caravan" is carrying. Morgiana then fills those jugs with boiling oil.
* GuileHero: Morgiana.
* Greed: Kasym's FatalFlaw. He apparently intends to loot the whole treasure cave in one take, lingers too long and forgets the password.
* HeKnowsTooMuch: At first, this is the reason why the Bandit Chief devotes so much time to finding and killing Ali Baba, to keep the location of his horde a secret. (When all his men are dead, however, it becomes a matter of self-preservation.)
* NeedleInAStackOfNeedles: One of the thieves learns the location of Ali Baba's house, and puts a mark on his door. While he's away fetching the rest of the thieves, Morgiana sees the mark, and thinking quickly she puts the same mark on every other door in the street. A second thief tries to mark the door more surreptitiously, but Morgana notices the mark anyway and does the same thing. The leader of the thieves is smarter, however, and choses to study the house and area until he memorizes the location.
** This same tactic is used by one of the money-guarding dogs in the HansChristianAndersen tale "Literature/TheTinderbox".
* OpenSesame: TropeNamer. Also requires a "Shut Sesame" upon leaving the cave.
* SacredHospitality: A dinner guest at Ali Baba's house says that he is unable to eat anything with salt in; his excuse is a dietary restriction, but actually he's the bandit chief, come in disguise to kill Ali Baba, and if he eats salt while he's a guest, he has "shared salt" with his host and is bound by the laws of hospitality. This is actually how Morgiana figures out the mysterious guest was the Bandit Chief.
* SpellMyNameWithAnS: Depending on the version of the story, Ali Baba's brother is either spelled "Kasim", "Cassim", or "Kasym".
* TreasureRoom: The thieves' cave.
* TryEverything: Ali Baba's brother Kasim attempts his own raid on the thieves' cave, but forgets the password, attempting several different kinds of grain without recalling the right one. "Open Barley?"
* YouHaveFailedMe: The bandit leader kills two of his men who volunteer to find the house and mess up. (See NeedleInAStackOfNeedles, above.) Then he wises up and decides to do it himself.