Indonesia is pushing to clamp down on gay and pre-marital sex as part of a sweeping criminal law overhaul that critics blame on a wave of religious fundamentalism sweeping across the world's biggest Muslim-majority nation.
The proposed shake up -- which also takes aim at condom use and adultery -- is winning unprecedented support ahead of 2019 presidential elections, after earlier attempts to shake up Indonesia's Dutch-colonial era laws fizzled.
Parliament is drawing up the new code with all the major political parties reportedly on board and the draft is expected to be tabled in the coming months.
Wide swathes of Indonesian society -- including heterosexual couples who might face jail for having sex outside wedlock or having an affair -- may be impacted if the laws pass.
But the Southeast Asian nation's small LGBT community could feel the sting most.
"Some politicians see it as an opportunity to cater to the religious base," said political analyst Yuventius Nicky.
"There's this supposed morality threat that is being queer."
Government officials, religious hardliners and influential Islamic groups have lined up to make anti-LGBT statements in public recently.
Last month, Google pulled one of the world's largest gay dating apps from the Indonesian version of its online store in response to government demands.
And police have used a tough anti-pornography law to criminalise members of the lesbian, gay, bisexual and transgender (LGBT) community.
Parliamentary speaker Bambang Soesatyo called this week for a crackdown on the community's "excesses", after the health ministry announced it would release a medical guide classifying homosexuality as a "mental disorder".
Gay sex is currently legal everywhere in secular Indonesia except for Aceh where it is banned under the semi-autonomous province's Islamic law.
The UN human rights chief blasted Indonesia's proposed laws and raised them in talks with President Joko Widodo this week.
"The hateful rhetoric against this (LGBT) community that is being cultivated seemingly for cynical political purposes will only deepen their suffering and create unnecessary divisions," UN High Commissioner for Human Rights Zeid Ra'ad Al Hussein told reporters.
"Any discriminatory provisions (in the new law) need to be removed," he added.
The code's latest draft carries a five-year jail term for extramarital sex or adultery, fuelling concerns that same-sex couples, who cannot marry in Indonesia, could be caught up in the dragnet.
It also carries penalties for "showing or offering contraception tools without authorisation" and calls for stiffer blasphemy sentences.
Supporters of the changes include the Family Love Alliance, a lobby group which made a failed attempt to get the constitutional court to outlaw extramarital and same-sex relations.
"Gay sex is deplorable," Alliance leader Rita Soebagio told AFP.
But the new law "does not mean that many people would be arrested. It's just like when the law on corruption was passed, not everybody was arrested for corruption".
Last month, police in Aceh made global headlines by publicly humiliating a group of transgender women, in the latest challenge to Indonesia's reputation as a bastion of progressiveness and religious tolerance.
"If these laws were passed it would give them (police) legitimate reasons or a basis for them to conduct these kinds of raids," said human rights lawyer Ricky Gunawan.
"This is a worrying and alarming trend of persecution against LGBT and other minorities."
Hardliners' ultimate goal, some say, is nationwide Islamic law modelled on Aceh, where public flogging is a common punishment for a slew of activities that are legal elsewhere in Indonesia, including pre-marital sex and selling alcohol.
"This is their grand scheme," said LGBT activist Dede Oetomo.
The idea is not without public support.
A poll last month said nearly 90 percent of Indonesians felt "threatened" by the LGBT community, while a 2013 Pew survey said 72 percent of Indonesian Muslims supported replacing the secular code with Islamic law.
In a case that highlighted growing links between politics and religion, Jakarta's first Christian leader was jailed on blasphemy charges levelled by supporters of his challenger, who won a come-from-behind race for city governor.
Rights groups are now scrambling to muster resistance to the proposed laws with a nearly 57,000 signature petition.
Widodo has veto power, but he needs to buoy support among increasingly influential Islamic groups ahead of a 2019 re-election bid.
"People in the government are carefully trying to fend that off," said rights lawyer Gunawan.