One Thousand and One Nights is a collection of Middle Eastern folk tales compiled in Arabic during the Islamic Golden Age. It is often known in English as the Arabian Nights, from the first English-language edition (c. 1706 – c. 1721), which rendered the title as The Arabian Nights’ Entertainment.
The work was collected over many centuries by various authors, translators, and scholars across West, Central, and South Asia and North Africa. Some tales themselves trace their roots back to ancient and medieval Arabic, Persian, Greek, Indian, Jewish and Turkish folklore and literature. In particular, many tales were originally folk stories from the Abbasid and Mamluk eras, while others, especially the frame story, are most probably drawn from the Pahlavi Persian work Hezār Afsān (Persian: هزار افسان, lit. A Thousand Tales), which in turn relied partly on Indian elements.
This story of Ali Baba and the Forty Thieves is included in many versions of the One Thousand and One Nights, which it was added to in the 18th century by Antoine Galland, who heard the story from a Syrian storyteller, Hanna Diyab. It is one of the most familiar of the “Arabian Nights” tales, and has been widely retold and performed in many media, especially for children, where the more violent aspects of the story are often suppressed.
In the story, Ali Baba is a poor woodcutter who discovers the secret of a thieves’ den, entered with the phrase “Open Sesame”. The thieves learn this and try to kill Ali Baba, but Ali Baba’s faithful slave-girl foils their plots. Ali Baba gives his son to her in marriage and keeps the secret of the treasure.