Police in Indonesia's most populous province plan to deploy a task force to investigate lesbian, gay, bisexual and transgender activity, a move likely to fuel concerns of a widening crackdown on the community in the Muslim-majority country.

West Java police chief Anton Charliyan disclosed the plan on Tuesday as two gay men in the province of Aceh were publicly flogged, and days after police raided a gay club in Jakarta and distributed photos of suspects to the media.

An Indonesian man is publicly caned for having gay sex in Banda Aceh, Indonesia, on May 23. Beawiharta / Reuters

With the exception of Aceh, homosexuality is legal in Indonesia. Activists say, however, that police targeting of consensual gay sex has shone a light on discrimination and harassment in the world's third-largest democracy.

Indonesia's reputation for tolerance is already under scrutiny after Jakarta Governor Basuki Tjahaja Purnama, a Christian, was sentenced this month to two years in prison for blasphemy.

Responding to Sunday's Jakarta raid, Charliyan told reporters in Bandung, the capital of West Java, a province with a population of about 47 million, that LGBTQ people suffered a "disease of the body and soul".

He called on the public to report their activities.

"I hope there are no followers in West Java, no gay or LGBT lifestyle or tradition, Charliyan said. "If there's anyone following it, they will face the law and heavy social sanctions. They will not be accepted in society."

"Morals Police"

A leading LGBTQ activist slammed his remarks, which were confirmed in a recording provided to Reuters by journalists present when Charliyan spoke on Tuesday.

"Police have a mandate to follow the law. They are not the morals police," said Yuli Rustinawati, chairperson of Arus Pelangi, an Indonesian LGBTQ activist organization.

Related: Two Men Publicly Caned In Indonesia for Having Gay Sex

In remarks on Wednesday, Charliyan said the police "task force" would include intelligence specialists and was particularly concerned with disrupting "secret parties," the Detik news portal reported.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

A national spokesman for the police, Setyo Wasisto, said the approach in West Java did not reflect a national strategy.

"It is enough for us to handle it as we do regularly," he said.

Charliyan's comments follow a spate of high-profile police actions against gay clubs and parties just as the country's Constitutional Court is due to rule on a petition to outlaw homosexuality and adultery.

Men arrested in a recent raid stand in line during a press conference at a police station in Jakarta on May 22, 2017. Fernando / AFP - Getty Images

On Sunday, police detained 141 men and released photos of some of them in varying states of undress to the media, revealing many of their identities. Only 10 of the men have been declared suspects, five remain under investigation and 126 were released.

The police said the photos were released due to "procedural errors," the Jakarta Post reported.

Rustinawati at Arus Pelangi said, however, the release of the images was part of a police pattern of publicly shaming of gay people.

Named and Shamed

The two Acehnese men, caned 82 times each on Tuesday, were punished in front of a crowd of more than 1,000. Semi-autonomous Aceh province is governed by sharia Islamic law.

Earlier, a video of the men, naked and distressed as they were apprehended by sharia police, was released and viewed widely on social media.

Related: Indonesian Police Detain 141 Men in Gay Club Raid

In Indonesia's second-largest city of Surabaya in East Java, 14 gay men were arrested, tested for HIV and the results made public, Indonesian media reported.

"The police also release data - names and addresses," said Rustinawati. "It's humiliating and it puts LGBT people in danger."

On Tuesday, North Jakarta police chief Dwiyono, who like many Indonesians has only one name, took journalists through the gay club raided on Sunday. As they climbed three floors, he pointed out a gym, a communal jacuzzi used for "striptease" and a cluster of cubicles for sex.

"This door can only be opened if you pay 185,000 rupiah ($14) to the receptionist," he said. "In here, there's no change room, you just tear off your clothes and use a towel."

Public Disapproval

Indonesian President Joko Widodo last year gave qualified support for the gay community, telling the BBC that "there should be no discrimination against anyone", before noting that homosexuality is not popular in his country.

However, his defense minister, Ryamizard Ryacudu, suggested that homosexuality was a national security threat and part of a "proxy war" waged against Indonesia by foreign states.

An Indonesian man, one of two to be publicly caned for having gay sex, is taken to be caned in Banda Aceh on May 23. Chaideer Mahyuddin / AFP - Getty Images

A Pew Research Center poll in 2013 found 93 percent of respondents in Indonesia disagreed that "society should accept homosexuality".

Indonesia's Islamist groups have long called for the criminalization of gay sex. The Islamic Defenders Front (FPI), the vigilante group that led huge rallies against the now-convicted Jakarta governor, has cooperated with police in curbing alleged vice for more than a decade.

Follow NBC Out on Twitter, Facebook and Instagram