IT’S an ancient tradition with thousands of pilgrims taking part each year.

Participants range from married men to housewives, government officials to prostitutes, all indulging in a mass ritual of adultery and sex.

And all of this takes place in a small corner of the world’s largest Muslim majority country.

Welcome to Indonesia’s Sex Mountain.

SBS Dateline journalist Patrick Abboud was granted rare access to visit the ancient mountain and its religious sexual rituals.

Abboud told news.com.au that thousands of Indonesian pilgrims travel across the archipelago to the Gunung Kemukus to take part in a religious ritual on an mountain top, believing sex out of wedlock at this holy site will bring them good luck and fortune.

Abboud said that the ancient ritual dates back to the 16th century, which in many ways goes against the law of Islam, especially sex out of wedlock, adding people were often reluctant to talk about it.

“It’s unique to Java — it’s an ancient Islamic Javanese tradition that happens every 35 days,” he said.

Legend has it that the ritual started when a young Indonesian Prince, Pangeran Samodro, had an affair with his stepmother.

They ran away and hid on Gunung Kemukus, but were caught and killed during sex and buried on top of the mountain in what is now an Islamic shrine.

Pilgrims believe having sex at the site will not only bring them good fortune but also wealth.

But Abboud reveals there is a catch.

For the magic to work and the wealth to take place, it’s believed the sex partner for the ritual should not be a spouse.

He also said pilgrims must also copulate on the mountain every 35 days, seven consecutive times.

“The majority are poor farmers and workers who believe visiting the site and having sex will bring them more success,” he said.

Abboud said many were also devout Muslims and the pilgrimage wasn’t just about sex.

First they visit a shrine to pray, then are washed in a sacred spring before prayers are held.

“It was really emotional watching lots of people praying,” he said.

“Once that’s over, pilgrims find a partner.”

But if you think it’s all married couples, think again, some men travel without their wives, helping spawn a burgeoning prostitution ring which the government turns a blind eye to because of the fee it charges pilgrims to visit the site.

Abboud said thousands of sex workers were at the site, and sexual health doctors he spoke to said diseases were rampart as many of the men didn’t want to wear condoms.

“It’s such a paradox, and it’s hard to make sense out of,” he said.

“It’s a strange snapshot of an Islamic ritual which really asks how it’s possible to exist given they are devout Muslims.”

Abboud added this ritual doesn’t take place anywhere else in Indonesia or the rest of the Muslim world and is a very Javanese blend of religious ideals — with Islamic, Hindu and Buddhist influences.