Indonesian police detained 51 men including several foreigners in a raid on what authorities described as a “gay spa” in Jakarta late on Friday, and some could face six years in prison under pornography and prostitution laws.

The arrests are the latest in a spate of high-profile police actions against gay clubs and parties in Indonesia this year that have called the country’s reputation for tolerance into question.

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, home to the world’s largest Muslim population.

Among those detained at the spa in central Jakarta were four Chinese nationals, a Singaporean, one Thai national, one Malaysian, and one Dutchman, although none of the foreigners would be charged, Jakarta Police spokesman Argo Yuwono said on Saturday.

When asked about what the people in the spa were doing at the time of the raid, Yuwono noted that it was dark at the time.

“LGBT is clearly between men and men or same-sex relationships. Male prostitution,” Yuwono said, without clarifying further.

“There’s a cashier, the manager there and also those providing facilities like towels and other things,” he said.

Activists say police targeting of consensual gay sex has shone a light on discrimination and harassment in the world’s third-largest democracy.

Andreas Harsono, a Jakarta-based researcher for Human Rights Watch, referred to a pattern of discriminatory police action against lesbian, gay, bisexual, and transgender (LGBT) people in Indonesia.

“If they raided [the club] because they are gay, it is abusive, it is abuse of power,” he said, adding that there is no law against homosexuality as long as relationships are consensual. “If there is no victim, there is no crime.”

Police often use the pornography law to “criminalise” such cases, but that law itself is also problematic, Harsono said, noting that people could be charged if they had pornographic material on a mobile phone.

“Just imagine if every person in Indonesia had their mobile phones checked, how many hundred million people would go to jail?” he said.

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”.