Updated

Riding a tsunami of moral conservatism and anti-gay prejudice, Indonesia's Islamic political parties appear on the cusp of a major victory: outlawing all sex outside marriage.

Revisions to Indonesia's criminal code being considered by Parliament would allow prison sentences of up to five years for sex between unmarried people. Those changes would also criminalize gay sex, the bugbear of Indonesia's Islamic and secular political parties.

Rights groups and legal experts fear a profound setback to human rights and privacy in Indonesia, one of the world's largest democracies, and the spread of vigilantism, already common in parts of the sprawling Muslim-majority nation of more than 250 million people. They are racing to organize opposition. An online petition launched this week has gathered more than 20,000 signatures.

"Indonesia, whose constitution guarantees human rights and has ratified many human rights covenants, will be ridiculed by the world for creating a law that is potentially violating many of those rights," said Said Muhammad Isnur, head of advocacy at the Indonesian Legal Aid Institute Foundation.

While the possible criminalization of sex between unmarried consenting adults has grabbed attention, the revised criminal code, which has nearly 800 articles, also contains changes that could weaken checks and balances in Indonesia's young democracy. One article potentially makes criticism of the president defamation and other articles could be used to weaken the Corruption Eradication Commission, one of Indonesia's most effective public institutions.

Asrul Sani, a lawmaker from the Islamic-based United Development Party, has told reporters that a 25-member parliamentary working committee has agreed on nearly all the articles in the revised code. It and another Islamic party are seeking longer prison sentences for gay sex in circumstances that involve force, public acts or pornography and that is still being argued, he said.

Statements from different committee members indicate there isn't total agreement but a majority of parties appear to have swung behind at least criminalization of gay sex. Bambang Soesatyo, the speaker of Parliament and a lawmaker from the major secular party Golkar, said same-sex relationships should be criminalized because they could "corrupt the morality of the nation." A few politicians outside the committee have raised concerns about the fundamental threat to privacy.

One of the obstacles in the way of the Islamic parties is President Joko "Jokowi" Widodo's power of veto. But with provincial elections due this year and a presidential race in 2019, it's unclear whether Jokowi is willing to risk political capital on protecting a hated and misunderstood minority or being seen as soft on morality issues.

"The Islamic parties are really using this issue as their marketing going into the political years, this year and next year," said Bivitri Susantri, a constitutional law expert who helped establish the Indonesian Center of Law and Policy Studies.

"The only thing we can do is to push the government, the president, to stop this," she said. "Because if we see how the political parties, both the secular ones and the Islamic ones discuss this, I think this draft law will be passed as it is now."

Islamic parties make up four of the 10 factions in Indonesia's Parliament and due to the popular vote threshold being raised to 4 percent, are at risk of losing their seats in Parliament next year if they can't rouse their bases.

They have typically commanded far less votes than secular parties, but their concerns resonate with a broad cross-section of Indonesians. Hard-line Muslim groups considered fringe a decade ago, such as the Islamic Defenders Front, have moved into the mainstream and shook Jokowi's government last year with a mass movement against the minority Christian governor of Jakarta, who was subsequently imprisoned for two years for blasphemy.

Conservative groups such as the Family Love Alliance believe Indonesia is being overwhelmed by immoral behavior such as sex between unmarried young couples, and in December nearly succeeding in convincing Indonesia's Constitutional Court to outlaw gay sex and sex outside marriage.

Moderate groups, meanwhile, have struggled to muster their forces. While many speak out online, that has little impact compared with the ability of Islamic groups to summon tens of thousands for mass protests.

The Islamic parties' message is perhaps at its most politically potent when aimed at Indonesia's besieged LGBT minority, which for the past two years has been the target of an escalating campaign of raids, arrests, hateful rhetoric from government officials and vigilante attacks.

Police in the conservative province of Aceh, which practices Shariah law, over the weekend rounded up 12 transgender people who worked in hair salons and publicly humiliated them by forcing them into men's clothing and cutting their hair.

Susantri and other legal experts said enforcement would be a huge and impossible burden on police and encourage vigilante acts from self-appointed "guardians of morality," undermining an already fragile rule of law in Indonesia.

She said people who practice religions not recognized by the state could also be criminalized because their marriages aren't recognized.

"The president should say no to this law," Susantri said. "But looking at how Jokowi is handling issues related to Islam I think he wouldn't do that."

___

Associated Press writers Niniek Karmini and Ali Kotarumalos contributed to this report.