An evil wizard finds King Solomon's magic lantern, but Solomon's curse prevents him from taking it - only someone born the same month, same day and same hour as Solomon can take it. That someone is Ali Baba, a poor, kind-hearted lad who lives with his brother, Ali Mama (Eric Tsang). When Ali Baba sees the 40 thieves enter their hideout and learns the ritual needed for entrance, he steals some gold and jewels. The 40 find out and capture Ali Baba, but he is saved by the evil wizard and taken to retrieve the magic lantern. Ali Baba releases the genie...and you know the story. It all culminates in a chase, the wizard on a flying horse and Ali Baba on his flying carpet.