The Indonesian government is reportedly on the verge of passing a law that would make all sex outside marriage illegal.

According to a report from the Associated Press, the country's parliament is considering landmark revisions to the nation's criminal code. Among the changes that could be introduced, sex between unmarried people could be punished with jail sentences of up to five years, while gay sex would also be outlawed.

In the world's most populous Muslim-majority nation, the theme of sexual rights has always been a major source of debate. The country's secular and Islamic political parties in particular have for years campaigned to ban gay sex.

Bambang Soesatyo, speaker of parliament and a lawmaker from the major secular party Golkar, said same-sex relationships ought to be made illegal as they could "corrupt the morality of the nation".

Predictably, the proposed reforms have left human rights campaigners dismayed and an online petition to oppose the planned changes has already gathered 20,000 signatures after its launch.

Said Muhammad Isnur, head of advocacy at the Indonesian Legal Aid Institute Foundation, was quoted as saying: "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."

According to conservative groups such as the Family Love Alliance, Indonesia is being overwhelmed by immoral behaviour such as sex between unmarried young couples.

Meanwhile, a number of hardline Muslim groups have become more mainstream in recent years and their views appeal to a broader section of the public, compared to those of the more traditional secular parties.

Conversely, moderate groups have failed to garner enough support, as they struggle to compete with the numbers gathered by Muslim groups.

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