YOGYAKARTA, Indonesia — As if on cue, the two Buddhist monks in saffron robes appeared one late afternoon recently, seemingly out of nowhere, to complete the picture of Indonesia’s religious past and present.
The visitors stood at the edge of a large fenced-off pit where a ninth-century Hindu temple had recently been unearthed here on the campus of the Islamic University of Indonesia. On the other side of the pit, where a mosque’s large dome rose in the backdrop, the muezzin would soon call the faithful to the sunset prayer.
The discovery of the nearly intact Hindu temple was a reminder of the long religious trajectory of the country that now has the world’s largest Muslim population. In few places on earth have three major religions intermixed with such intensity and proximity as in Indonesia’s island of Java. If the sultan of Yogyakarta’s palace lies at the heart of this city, Java’s spiritual center, the world’s largest Buddhist monument, Borobudur, and one of its largest Hindu temples, Prambanan, stand in its outskirts.
About 90 percent of Indonesians are now Muslim, with only pockets of Buddhists and Hindus left. But Hinduism and Buddhism, Java’s dominant religions for a much longer period, permeate the society and contribute to Indonesia’s traditionally moderate form of Islam.
For more than a decade, proponents of a more orthodox version of Islam have gained ground in Indonesia. More women are wearing head scarves and more Indonesians are adopting Arabic-style religious rituals as fundamentalists press for a purge of pre-Islamic values and ceremonies. But Indonesia’s traditional Islam provides a counterpoint.
“This is Indonesia,” said Suwarsono Muhammad, an official at the Islamic University. “In the long history of Indonesia, we have proven that different religions can live peacefully.”
In that spirit, Mr. Muhammad said, the university planned to showcase the Hindu temple prominently in front of a library to be built around it, in the shape of a half-circle.
It all began last August when the private university decided to build the library, “the symbol of knowledge of our religion,” next to the mosque, Mr. Muhammad said. In the two decades the university had occupied its 79-acre campus outside Yogyakarta, no temple had ever been found. But chances were high that they were around. Most of the nearby villages had the same prefix in their names: candi, meaning temple.
By Dec. 11, a construction crew had already removed nearly seven feet of earth. But the soil proved unstable, and the crew decided to dig 20 inches deeper. A backhoe then struck something unusually hard.
The crack the backhoe left on the temple wall would become the main sign of damage on what experts say could be the best-preserved ancient monument found in Java.
Researchers from the government’s Archaeological Office in Yogyakarta headed to the campus the next day, excavated for 35 days and eventually unearthed two 1,100-year-old small temples. In the main temple, 20 feet by 20 feet, a perfectly preserved statue of Ganesha, the elephant-headed deity, sat next to a linga, the symbol of worship for the god Shiva, and a yoni, the symbol of worship for the goddess Shakti.
In the adjacent secondary temple, about 20 feet by 13 feet, researchers exhumed another linga and yoni, as well as two altars and a statue of Nandi, the sacred bull that carried Shiva.
“The temples are not so big, but they have features that we haven’t found in Indonesia before,” Herni Pramastuti, who runs the Archaeological Office, said, pointing to the rectangle-shaped temple, the existence of two sets of linga and yoni, and the presence of two altars.
Researchers surmised that the temples were preserved in pristine condition because they were buried in a volcanic eruption a century after they were built. The lava from Mount Merapi, about 7.5 miles to the north, is believed to have filled a nearby river before flowing over the temples, minimizing damage.
Indung Panca Putra, a researcher at the Archaeological Office, said the temples’ walls and statues contained refined details not found in the dozen small Hindu and Buddhist temples discovered in this area.
Officials moved the most valuable artifact, the statue of Ganesha, to the Archaeological Office. For further protection against thieves, workers erected a fence on the campus, and guards limited access inside.
The two Buddhist monks, though, had had no trouble getting inside. They had traveled from their monastery, about an hour away by car, to visit.
“These are our ancestors, so we have a sense of belonging,” said one monk, Dhammiko.
Historians believe that Hinduism spread in Java in the fifth century, followed three centuries later by Buddhism. Kingdoms hewing to both Hindu and Buddhist beliefs flourished in Java before they were eclipsed by Islam in the 15th century.
But Islam itself incorporated beliefs and ceremonies from the other two religions. Just as some unearthed temples in east Java have a Hindu upper half and a Buddhist lower half, some early mosques had roofs in the shape of Hindu temples, said Timbul Haryono, a professor of archaeology at Gadjah Mada University here and an expert on Hinduism in Southeast Asia. Early mosques faced not in Mecca’s direction, but west or east in the manner of Hindu temples.
“Things didn’t change all of a sudden,” Mr. Haryono said. “Islam was adopted through a process of acculturation.”
In Indonesia’s arts, like the wayang shadow puppetry that dramatizes Hindu epics, or in people’s private lives, traces of the earlier religions survive, he said. Food, flowers and incense still accompany many funerals for Muslims, in keeping with Hindu and Buddhist traditions.
“Hinduism was Indonesia’s main religion for 1,000 years,” he said, “so its influence is still strong.”