Prambanan, the 9th century temple compound in Central Java, is one of the largest and the most beautiful structures in Southeast Asia, characterized by its tall, pointed spires, the majestic central structures towering nearly 50m above a large complex of 224 individual temples. While it is dedicated to the Hindu Trinity, i.e. expression of God as the Creator (Brahma), the Sustainer (Vishnu) and the Destroyer (Shiva), and while the focal deities in the major temples are, indeed, Mahadewa, Brahma and Wisnu, the temple-complex has locally always been called Candi Loro Jongrang.
Who is Loro Jongrang (aka Roro Jonggrang or Lara Djonggrang, meaning Slender Virgin)? To find out, we have to travel to 9th-century Java, when the sun was setting over 100 years of rule by the Buddhist Shailendra dynasty (under whose patronage Borobudur had been created.) The Hindu Sanjaya dynasty was increasingly assertive, and local rajas were shifting their allegiance from Mahayana Buddhism to Shaivaite Hinduism.
Complicating the power struggle were court-intrigues -- featuring Pramodhawardhani, daughter of the Shailendra king and object-of-desire of the Sanjaya prince Rakai Pikatan. Rakai Pikatan was in contest against Pramodhawardhani's brother Balaputradewa, heir to the Shailendra throne. Pramodhawardhini's role is ambiguous -- she may have tried to ally herself to both sides -- but eventually, intrigue or not, the Mahayana bhairavs (demons) could not help Balaputradeva, the gods of Rakai Pikatan triumphed, ending Shailendra rule in Central Java.
In the popular legend, which took its modern shape in Majapahit times many centuries later, there are two neighboring kingdoms -- Pengging and Boko. Pengging (the Sanjaya kingdom) is prosperous, for it is wisely ruled by its king Prabu Damar Moyo (in addition to histories even legends are written by the winners), and its clever prince Bandung Bondowoso commands a legion of netherworld-spirits. In contrast, the overlord of Boko (the Shailendra principality) is a cruel cannibalistic giant Prabu Boko, supported by another ogre Patih Gupolo. Despite his uncouthness, Prabu Boko has a beautiful daughter -- the 'Slender Virgin' Loro Jonggrang.
Boko is consumed by envy of his neighbor, and so raises taxes and armies for an invasion of Pengging. His forces launch a surprise attack, the ensuring war causes devastation and widespread famine, on both sides.
Prabu Damar Moyo sends his son Bandung Bondowoso to battle. After a furious contest, Boko is killed by the prince's supernatural powers. His assistant, the ogre Patih Gupolo, escapes with the shattered remnants of corps Boko.
The princess is heartbroken.
In short order, the Pengging host arrives to besiege and capture the Boko palace. Striding through the inner halls, prince Bandung Bondowoso comes upon the mourning princess and is mesmerized by her beauty. He proposes that the winning and losing sides be henceforth joined in matrimony. The shotgun (so to speak) pointed at her, Loro Jonggrang agrees, but on two surely-impossible conditions: first, the prince must build a well named Jalatunda; second, he must construct a thousand temples in one night.
Bondowoso immediately starts work on the well, calling upon his spirits and using his supernatural powers, and lo, it is done. She urges him to enter Jalatunda; when he does so, Patih Gupolo pours an avalanche of stones into the well to bury the prince alive. With great effort Bandung Bondowoso escapes. Loro Jongrang blames the no-hopers fighting on under Gupolo, and sweetly asks Bondowoso to fulfill the second condition.
Somewhat suspicious after Act I, the prince enters into meditation and conjures up a host of earth-spirits. They work through the night, and there come into being, one after another as the night wears on, the first 999 temples. Yet Loro Jonggrang has a clever plan. The princess and her maids light a fire in the east, and ask all the villagers to begin pounding rice, an activity traditionally done just before dawn. Fooled into thinking the sun is about to rise, the rooster crows, and the spirits flee back into the netherworld, leaving the last statue of the last temple unfinished.
The prince is furious when he learns of this deception. He leaves the palace, placing a curse on Loro Jonggrang, that her body turn into stone to match her heart. So she herself becomes the final statue of the temple, completing its construction and fulfilling the condition for their marriage. The gods intercede, releasing Loro Djongrang's soul which rises to the heavens.
There are several curious aspects to the legend.
First, the 1000th statue, which the locals revere as Loro Djonggrang, is easily recognizable as being one of Durga Mahishasurmardini. (Her many arms, the buffalo at her feet and the demon she holds by the hair place her distinctly within the framework of Durga, as does the placement of the statue in the Shiva temple next to a statue of Ganesha.)
From A Guide through Netherlands India (1906):
At the further end of the lobby are two images respectively representing Siva (as "Goeroe") the Teacher, and as Kala (the Destroyer Time), and in the central room is a large, but broken image of the same Deity as the principal god (Maha-dewa). In the west room is found an image of Ganesa Son of Siva, and in the north room is the famous eight-armed image of Loro Djonggrang (Durga, the consort of Siva). This image is 6 feet high and the entire ruin is often known, after it, as Tjandi Loro Djonggrang.
There is, however, no explanation of how the stories connect -- how did Loro become associated with Durga? Is it that, casting their eyes around the goddesses of the Hindu pantheon -- Saraswati, Lakshmi, Ganga, Sita, Radhika -- the Javanese could not find a match, the only strong woman being Durga? For Shaktas, the eternal virgin Durga is Adi Shakti (the original power) -- this notion may also have made the identification of Loro with Durga easier. But it remains a stretch; there is nothing of the story of Durga in Loro, and none of Loro in Durga, even if certain facets are claimed to match.
Second, why would this defiant maiden find such lasting worship in the sanctuaries of her opponents? Is it that we all identify with the tragic? Or, perhaps, each of the parties to the underlying conflict got something out of the deification of Loro Jongrang. For the Hindus, through her demands they got a thousand temples, and indeed she metaphorically became one of them. For the Buddhists, it was one of their own, their princess, who went to live in the temple of Shiva.
Or is it that, as some historians suggest, Pramodhawardhini/Loro was actually married to Rakai Pikatan/Bondowoso and helped plot the downfall of her Buddhist brother? There is a very faint nimbus around the head of the Loro Jonggrang statue in Prambanan, and some scholars have suggested reading into it a Buddhist iconography. There has been, from the beginning, confusion about how much Hindu-Buddhist fusion Prambanan actually represents.
From Allen's Indian Mail, "a register of intelligence for British and foreign India, China, and all parts of the East" (1851):
Visited and sketched by Colonel Mackenzie in 1812, and subsequently by Captain G. Baker, whose report to the Government contains facts of some value towards an elucidation of the question. "One of these arises from the circumstance of his having been accompanied by a sepoy, who would seem to have been a Brahman himself, and had resided two years among the Brahmans at Benares. Colonel Mackenzie considered these ruins at Brambanam to be decidedly Bauddhistical; the sepoy, on the contrary, regarded them as Brahmanical, though surpassing in number and style of execution anything of the kind which he had seen in India.
Why an 8-armed Durga? Mahishasurmardini appears quite early in Indian art. The Archaeological Museum in Mathura has on display a 6-armed Kushana period Mahishasurmardini that depicts her pressing down the buffalo with her lower hands. A Nagar plaque from the first century BC depicts a 4-armed Mahishasurmardini, accompanied by a lion. In the Gupta period we see various representations of Mahishasurmardini (2-, 4-, 6-, and at Udayagiri, 12-armed), the spear and trident her most common weapons. At Mahabalipuram (contemporaneous, roughly, with Prambanan), a relief (pictured below) shows the goddess with 8 arms (some on one side have broken off but the symmetry is clear from the other side) riding her lion and subduing with bow-and-arrow a Mesopotamian-looking buffalo-faced asura (as opposed to buffalo asura), a variation also seen at Ellora.
Third, there are actually 1001 statues. An accounting is provided in the book Rāma-legends and Rāma-reliefs in Indonesia. You don't have to be Holmes or Feluda to feel there is something very odd about the extra statue. The Loro legend very specifically builds up to 1000 statues; the temples were planned and executed with enormous precision bearing in mind a cosmic ritual significance; why, then, do we at the end find 1001 statues?
In terms of the disconnect between the Durga and Loro Jongrang traditions, it is of course possible that many of the royal family were models for the statues in temples, and the same statue could be both the royal and the divine, on different planes. In Angkor, Jayavarmana's face melds with that of the Buddha; in Java, here a King appears as Wisnu, there a pretty prince is immortal as a cherub on a panel. So it may not have been as remarkable that the Slender Virgin was the model for a Durga statue, and that in the minds of the audience the statue could be both the princess and the deity without contradiction. An uncle of mine calls every Sean Connery movie 'James Bond'; Hema Malini is forever Basanti Tangewali in rural India. A movie poster image could be Cleopatra, or Liz Taylor, or perhaps simultaneously both?
Finally, much has been made amongst scholars of Shailendra vs Sanjaya, Borobudur vs Prambanan. In practice, of course, both the Hindu and Mahayana traditions are too inclusive for there to remain a real schism in the population of the hinterland around Prambanan. Buddha is an avatar of Vishnu, and the Tara form of Durga is a female Bodhisattva. The conflict between clans (though not religions) was real at one time, and there was a couple whose story got tied up in the wars between their families, people understood that and made the story their own. Even today, lovers will avoid Candi Loro Djongrang; it is a place for breaking up.