In ancient Bagdad, the legendary Ali
Baba, known for stealing from the rich to free the poor, sends his
stalwart son Kashma to the Imperial Army, where he soon rises to the
top of the cadet class. Kashma's birthday celebration, which
is attended by his best friend Mustafa, most of the cadets and many
lovely harem girls, is interrupted by Kashma's rival, Hussein, the
son of the evil Caliph. A knife fight erupts, but Kashma's
friends defend him and throw Hussein into the pool.
The next day, Kiki, a girl claiming to
be a dancer escaped from Rama, an evil troupe leader, sneaks into
Kashma's estate. Kashma is smitten with her beauty and allows
her to stay, after which she secretly signals a hidden spy, who
informs the Caliph that his plan is in effect. That night,
Kashma's servant, Babu, informs him that no Rama exists, and Kiki is
forced to tell him that she is the handmaiden of the Princess Azura
of Morocco, who was kidnapped by the Caliph to be married off to the
Shah. Although Kashma is concerned that hiding an escaped
slave could mean his own death, he cannot resist Kiki and spirits
her away to his father's palace.
As soon as they leave, however, the
Caliph's guards search the estate. Finding a handkerchief
bearing the mark of the Moroccan monarchy, they arrest Mustafa for
allowing Kiki, who is actually the princess, to escape.
While escorting Mustafa to the dungeon,
the cadet's captain captain, Youssef, allows him to escape in order
to warn Ali Baba that the Caliph is on his way to attack. When
the Caliph later rounds up his army, many of the cadets refuse to
attack Ali Baba and are left with Youssef, who secretly lauds them.
Meanwhile, at Ali Baba's palace, Kashma
introduces Kiki to his childhood friend, Tala, who is now a
beautiful woman and expert marksman. Kashma tells his father
that he loves Kiki, but the next day, when Mustafa races in and
reveals Kiki's secret, Kashma rebukes her for endangering their
lives. Kashma, Tala and Mustafa nonetheless escort Kiki into
the hills to protect her.
Soon after, the Caliph invades and
searches the palace for treasure, leading Ali Baba to deduce that
the ruler never wanted the princess but only the riches. In
the hills, Kashma realizes that Kiki must have been spying for the
Caliph, as his men followed her to Ali Baba's but never tried to
capture her. He rushes back to the palace, but finds that the
Caliph has kidnapped Ali Baba to force Kashma to reveal where the
treasure is hidden. Hussein knocks out Kashma and sets the
palace on fire, and it is Kiki who risks her life to rescue him.
She tries to tell him that the Caliph forced her to help him by
imprisoning her mother, Princess Karma, but he no longer believes
her. With Tala and Mustafa, he rushes to lead the people of
the surrounding valley into the hills, where they watch in agony as
Hussein burns down their farms.
Kashma soon inspires the sons of the
original forty thieves of Ali Baba to fight the Caliph. They
race to town, where the Caliph is lying to the visiting Shah that he
killed Ali Baba for trying to steal the princess. Kashma leads
his rebels to the dungeon and rescues Ali Baba and Princess Karma.
After Tala shoots an arrow that kills the Caliph, Hussein orders his
men to kill Kashma.
At the same time, Kiki escapes from the
harem girls who have been instructed to guard her and races to the
army barracks, where she convinces Youssef to lead the cadets to the
palace. They arrive just in time to rescue the rebels, and as
they round up the prisoners, Hussein almost sneaks away.
Kashma sees him, however, and kills him in a duel. The Shah,
thankful that his old friend did not betray him, names Ali Baba the
new Caliph while Princess Karma gives her blessing to the union of
Kashma and Kiki.