Indonesia's parliament has approved a new criminal code that will make sex outside of marriage punishable by up to a year in prison.
It is part of a raft of changes that critics say erode people's rights.
The new criminal code will not come into effect for another three years and also includes a ban on insulting the president and speaking out against state ideology.
Protesters staged small rallies outside the parliament in Jakarta this week.
The code - which will apply to both Indonesians and foreigners - includes several "morality" laws which make it illegal for unmarried couples to live together and have sex.
Rights groups say this disproportionately affects women, LGBT people and ethnic minorities in the country.
A person's partner or parents can report them for the offence of having sex outside of marriage. Adultery will also be an offence for which people can be jailed.
Rights activists say the new code also suppresses political expression and clamps down on religious freedom.
There are now six blasphemy laws in the code, including apostasy - renouncing a religion. For the first time since its independence, Indonesia will make it illegal to persuade someone to be a non-believer.
New defamation articles also make it illegal for people to insult the president or express opinions against the national ideology.
However legislators said they had added defences for free speech and protests made in the "public interest".
Still, Human Rights Watch on Tuesday said the new code's provisions were a "disaster" for human rights.
The rights group's Asia Director Elaine Pearson told the BBC it was a "huge setback for a country that has tried to portray itself as a modern Muslim democracy."
The group's Jakarta-based researcher, Andreas Harsano, said there were millions of couples in Indonesia without marriage certificates "especially among Indigenous peoples or Muslims in rural areas" who had married in specific religious ceremonies.
"These people will be theoretically breaking the law as living together could be punished up to six months in prison," he told the BBC.
He added that research from Gulf states, where there are similar laws governing sex and relationships, showed women were punished and targeted by such morality laws more than men.