When an angry mob of Islamists threatened to burn down a place hosting a gay and lesbian film festival in Jakarta in 2010, Indonesian police came to protect those staging it.

A volunteer at the festival, Adi, 28, now fears that instead of safeguarding their rights authorities are targeting his community, forcing them to hide their lifestyles or even consider moving abroad.

Indonesia's Islamists have long sought to criminalise gay sex. The Islamic Defenders Front (FPI), the vigilante group that threatened the now defunct Q! film festival in Jakarta, has previously broken up what they said were gay parties and then urged the police to detain the men.

But what is sending a new chill through the gay community is that police seem to have taken on the vice patrol role themselves. In May, officers detained 141 men in a raid on the Atlantis sauna, accusing them of involvement in a gay prostitution ring in a part of Jakarta that is also home to many heterosexual "spas".

A month earlier, police raided a hotel in Indonesia's second-biggest city of Surabaya over an alleged "sex party" and made the 14 detained men undergo HIV tests before publicly releasing the results, local media reports said.

"Before this, we used to think of the police as our safety net when mass organisations, or anyone claiming to represent the people, came to attack us," said Adi, who works in e-commerce and asked to be identified using only one name.

"Now if I want to do anything, I'll do it in my apartment, in a private space," he said, adding he was thinking of emigrating.

US Congressional letter

With the exception of the ultra-conservative Aceh province in northern Sumatra, where Islamic law is enforced and two men were publicly flogged last month for gay sex, homosexuality is legal in Indonesia, the world's most populous Muslim country.

Police denied targeting the LGBT community.

The police raided the Atlantis and the Surabaya hotel because the gatherings there had caused "turmoil in the community", national police spokesman Rikwanto said. "As long as they are kept private and their (LGBT community's) personal affairs are kept to themselves, then it will not be a problem," he said.

Indonesia's reputation for tolerance and pluralism was already under scrutiny after Jakarta Governor Basuki Tjahaja Purnama, an ethnic Chinese Christian, was sentenced last month to two years in prison for blasphemy in a trial that came after mass Islamist-led rallies last year.

His case highlighted the role of Islamic vigilante groups like the FPI, who helped organise the protests against him. The groups are known for raiding bars and brothels during the fasting month of Ramadan. Some have been suspected in arson attacks on churches.

Predominantly Muslim Indonesia has substantial minorities of Christian, Buddhist, Hindus, Confucianists as well as non-Sunni Muslim creeds, such as Shias, who have expressed worries about the vigilantes.

Indonesia's Rainbow Village Show all 13 1 /13 Indonesia's Rainbow Village Indonesia's Rainbow Village Rainbow village This once struggling village in Indonesia was given a rainbow makeover last month. Instagram/Arief Rakhman Indonesia's Rainbow Village Rainbow village The village in Randusari was formerly known as Kampung Wonosari but has been renamed Kampung Pelangi. Instagram/Ilham Juwarto Indonesia's Rainbow Village Rainbow village Local government allocated £17,000 for the bold new look. Instagram/Ribekti_H Indonesia's Rainbow Village Rainbow village It was hoped that by painting the village in bright colours it might attract more tourists to the area. Instagram/Jalidin Indonesia's Rainbow Village Rainbow village Alongside the rainbow stripes adorning the buildings, there are also interesting murals on the walls. Instagram/Ilham Juwarto Indonesia's Rainbow Village Rainbow village The village has been trending on social media and tourists are flocking there for Instagram shots. Instagram/Safir Makki Indonesia's Rainbow Village Rainbow village The project took just over a month to complete and was unveiled in April. Instagram/Ditopapaojan Indonesia's Rainbow Village Rainbow village A local teacher was the brains behind the project, inspired by similar makeovers in other parts of Asia. Instagram/nicolas_ertaf Indonesia's Rainbow Village Rainbow village The village was considered a slum before the local government officials decided to turn things around. Instagram/jogjajateng Indonesia's Rainbow Village Rainbow village A total of 232 buildings were transformed, and coloured flags line the streets. Instagram/mzndoet Indonesia's Rainbow Village Rainbow village The face lift has given a new lease of life to Kampung Pelangi, turning it into a must-visit attraction. Instagram/mzndoet Indonesia's Rainbow Village Rainbow village Most of the manpower and material was provided by The Indonesian Builders Association. Instagram/puchy.nisa Indonesia's Rainbow Village Rainbow village Even the Mayor of nearby Semarang, Hendrar Prihadi, got involved by doing some painting. Instagram/Cindy Kurnia Lestari

Members of the US Congress sent a letter to the Indonesian government last week, stating their concern over the reports of possible human rights abuses targeting the gay community.

"These attacks are an unfortunate symptom of the growing radicalisation in Indonesia that has targeted women, religious and ethnic minorities, and which could negatively impact diplomatic relations and foreign investments in your country, if left unchecked," said the letter signed by 35 congress members.

An Indonesian presidential spokesman declined to comment on the letter. President Joko Widodo last year gave qualified support for the gay community, telling the BBC "there should be no discrimination against anyone", but noted homosexuality is not popular in his country.

Homosexuality remains a taboo topic with the public, which is why the gay community gathers away from the public eye in saunas and underground parties. A Pew Research Center poll in 2013 found 93 percent of respondents in Indonesia disagreed that "society should accept homosexuality".

Shared on social media

Activists say controversial anti-pornography laws, under which offenders can face up to 15 years' jail, were being misused against some of those rounded up during the recent raids in Jakarta. Police also seemed to be using shaming tactics in the raids.

The men detained at Jakarta's Atlantis sauna were nearly all later released without charge, but not before being strip-searched, photographed and marched semi-naked from the venue into vehicles. Adding to their humiliation, photos were then shared on social media.

"Honestly, after what happened, I'm scared. Because what the police stripped naked was not just your body, but your name, your place of work. I'm a lecturer so it could be a problem for me," said Ahmad, 33, who works at a university in Jakarta. He declined to give his full name or place of work, but nonetheless pledged he would not be deterred from visiting gay bars in Jakarta.

Amnesty International said the police raids were further evidence of an "increasingly hostile environment" for the gay community, fuelled over the past year by "reckless, inflammatory and inaccurate statements made by public officials apparently under the guise of âdefending public moralityâ."