(CNN) Indonesia is set to pass a highly controversial new penal code that would criminalize consensual sex outside of marriage and effectively outlaw same-sex relations , in a move human rights groups have criticized as a violation of basic freedoms.

The draft code, which will also introduce penalties for insulting the president, is set to be adopted as soon as next week, after the government agreed to the bill Wednesday.

Human Rights Watch called the draft criminal code "disastrous not only for women and religious and gender minorities, but for all Indonesians," and is calling on lawmakers to drop the controversial articles before passing the law.

A group of NGOs are now urging Indonesian President Joko Widodo to step in and delay the 628-article bill, before it is expected to be legalized on September 24.

Indonesia is the world's largest Muslim-majority country, but prides itself on being a tolerant nation with a diverse mix of ethnicities and religions. But there has been a rising intolerance in the country against religious and sexual minorities from increasingly assertive religious conservatives.

The ruling comes months after a closely fought election that saw progressives pitted against Islamic hardliners and worries over increased involvement by Islamic groups in politics were brought to the fore.

The new criminal code has been in the making for decades. Indonesia's Minister of Law and Human Rights Yasonna Laoly, who reintroduced the bill in 2015, told CNN that the law replaces the 100-year-old Dutch colonial-era penal code and would make Indonesia's criminal law more in line with how Indonesians live today.

"We would like to change to our new penal code to focus more on Indonesian perspectives in the law. The reason is because there are some laws in the penal code that are not suitable for Indonesia any more," Yasonna Laoly said.

The House of Representatives commission that oversees legal affairs agreed on the final draft on Wednesday and the bill will go to a parliamentary plenary session on September 24 where it will be made into law.

"This is a formality because all the parties in parliament have agreed," Laoly said.

Once ratified, the law will take about two years to take affect so the public and law enforcement can become familiar with the new regulations.

Rights groups say many of the articles would discriminate against against women, religious minorities, members of the LGBT community, as well as stymie freedom of speech and freedom of association.

Andreas Harsonso, senior Indonesia researcher at Human Rights Watch, said that the next century would "likely be disastrous for minorities in Indonesia."

Under the proposed law, extramarital sex can be punished by up to one year in prison and couples can be prosecuted if a close family lodges a police complaint.

Rights groups say, while the article does not specifically mention same-sex conduct, it effectively criminalizes all same-sex relationships. Members of the LGBT community, who already face persecution and discrimination in the country, could also be targeted with a vaguely-worded article that criminalizes "obscene acts" with a penalty of up to six months in prison.

And unmarried couples who are reported to police for living together could be sentenced to six months in prison or face a fine. A village chief can also file a police complaint if close family do not object.

Among the many changes to existing laws, the draft code states that only a doctors have the right to decide to perform an abortion and a woman could face four years in prison for having one. Anyone who helps a woman terminate her pregnancy faces five years in jail.

The code would also make it a criminal offense to insult the president or vice-president, raising concerns relating to the stifling of press freedom.

Head of the Indonesia Legal Aid Foundation, Asfinawati, who like many Indonesians goes by one name, said that the new penal code is a set back for democracy in the country.

"There are some articles that can easily put people into the jail and a lot of multi-interpretations on those articles," Asfinawati said, adding that they would conduct a judicial review.

Another provision expands the current blasphemy law and maintains the maximum five-year prison term, according to Human Rights Watch. The group said more than 150 people, most of them religious minorities, have been convicted under the law since it was passed in 1965, including former Jakarta Governor Basuki "Ahok" Purnama in 2017.

Some see the law as evidence that hardline religious forces are influencing politics -- an issue that was a major theme during recent elections -- and of increasing Islamic conservatism and intolerance against minorities in the country.

If passed, the law "will confirm that Indonesia is now becoming an Islamic state,"Harsono said. "The unwritten part of all of this arguments is that it is based on Islamic Shariah minus the lashing."

Northernmost Banda Aceh is the only province in the country that observes Shariah -- or Islamic law -- and those found guilty of breaking the strict morality laws are flogged in public

Minister of Law Yasonna Laoly said that was a "big misperception" and called the law a "legacy" as the bill was made for Indonesians by Indonesians.

"Not all the people agreed to some articles -- if we were to listen to everybody we would never finish this bill -- but we have made the best one. We have listened to everybody, every expert, political party and tried to come up with rules that can be accepted," he said.