Ali Baba and the Forty Thieves’ is a traditional Arabic tale found in One Thousand and One Nights. It has been much adapted and is a popular plot for pantomimes.
The story’s hero is Ali, son of a merchant who marries a poor woman. One night whilst collecting firewood he hears forty thieves visiting a cave, which they use to store their stolen treasure. The cave opens and closes to magic words which Ali has the fortune to overhear and he manages to steal from the thieves’ store. The thieves, despite their attempts to do away with Ali, are eventually tricked to their deaths and the treasure becomes Ali’s own.
In some versions of the story Ali is made out to be the leader of the thieves, but in the traditional tale he is simply an honest man who manages to outwit the evil band of thieves and claim his just rewards.