The legend tells the story about two ancient and neighbouring kingdoms in Java, Pengging and Boko.
Pengging was prosperous, and wisely ruled by its king Prabu Damar
Moyo who had a son named Bandung Bondowoso. By contrast, Boko was ruled
by a cruel man-eating giant named Prabu Boko, supported by another giant
Patih Gupolo. Despite his unpleasant nature, Prabu Boko had a beautiful
daughter named Rara Jonggrang.
The story relates that Prabu Boko desired to expand his kingdom, and
so began training an army and raising taxes for an invasion of Pengging.
His forces launch a surprise attack on Pengging, and the ensuring war
causes devastation and famine on both sides. In order to defeat the
invader, Prabu Damar Moyo sends his son Bandung Bondowoso to fight Prabu
Boko. After a furious battle, Prabu Boko is killed by the prince's
supernatural powers. His assistant, the giant Patih Gupolo, leads his
armies away from the battlefield in defeat.
Returning to Boko Palace, Patih Gupolo tells princess Rara Jonggrang
of the death of her father. The princess is heartbroken, but before she
can recover from her grief the Pengging army besieges and captures the
palace. Prince Bandung Bondowoso is mesmerized by the beauty of the
mourning princess and propose marriage, but his offer is swiftly
rejected. Bandung Bondowoso insists on the union, and finally Rara
Jonggrang agrees on two impossible conditions: first the prince must
build a well named Jalatunda, and second, he must construct a thousand
temples in only one night.
The lovestruck prince agrees, and immediately starts work on the
well. Using his supernatural powers once again, the prince swiftly
finishes construction and proudly displays his work for the princess. As
a trick, she urges him to enter the well and when he does so, Patih
Gupolo piles stones into it and buries him alive. With great effort
Bandung Bondowoso escapes, but his love for the princess is so strong
that he forgives her the attempt on his life.
To fulfill the second condition, the prince enters into meditation
and conjures up a multitude of demon spirits from the earth. With their
help he builds the first 999 temples and starts work on the final one.
To thwart his efforts the princess and her maids light a fire in the
east and begin pounding rice, a traditional dawn activity. Fooled into
thinking the sun is about to rise, the spirits flee back into the earth
leaving the last temple unfinished.
The prince is furious when he learns of this deception, and places a
curse on Rara Jonggrang which turns her into a stone statue. In this way
she herself becomes a feature of the final temple, completing its
construction and fulfilling the conditions for their marriage.