It's shaping as a bleak 2018 for Indonesia's gay and transgender people.

In the conservative province of Aceh, police have raided hair salons and publicly shamed a group of transgender hairdressers, while in the nation's capital, politicians are finalising new legislation which will make gay sex illegal.

Unmarried heterosexual couples could also be jailed for having sex.

Over the weekend, the police chief of North Aceh, Untung Sangaji, delivered an impassioned speech about his latest successful operation.

"The clerics don't want this disease spreading here," he shouted.

"It's true," shout the crowd.

Mr Sangaji is a hero in Indonesia. He's famous for running towards a terrorist attack in Jakarta in 2016, firing at the extremists with his handgun.

Now he's battling a different enemy: Trans people.

Loading

"It is inhumane if Untung Sangaji lets the number of sissies increase here," he told the crowd in the town of Lhoksukon.

The police chief led weekend raids on five trans hairdressing salons.

Twelve people — known as waria in Indonesia — were detained, had their heads shaved, forced to dress in men's clothing, and now have to endure "re-education".

Andreas Harsono from the NGO Human Rights Watch says one of the few jobs available to trans people has been taken from them.

"He's not only arresting them, he's not only intimidating them, he's also closing their businesses," Mr Harsono said.

"The police sealed those five hair salons."

Men, women having sex outside marriage could be a crime

It's the latest low point in a two-year campaign against Indonesian's LGBT people that's been marked by vitriol from politicians and clerics, arrests of consenting adults inside hotels, clubs and saunas and trials and convictions under anti-pornography legislation.

And now, Indonesian politicians are about to go much further.

Indonesia's ten main political parties have agreed on a new criminal code that will make it much easier to prosecute gay sex as well as sex between unmarried straight couples.

One of the politicians who has helped draw up the criminal code is Arsul Sani, the secretary general of the PPP Party.

"It applies to people of the same gender who have sex, which is basically a forbidden act," he said.

"It's considered the same as adultery, where men and women having sex outside marriage can be considered a crime."

Politicians says police won't be barging down doors to bust couples in the act — at least, not initially.

The laws will apply to behaviour in private spaces, like bedrooms. Authorities will act on complaints from aggrieved parties.

"The case can only be processed if there is a report from the husband or wife or children or parents," Mr Sani said.

"That is the basic formula that has been agreed by the criminal code taskforce, parliament, and government."

Millions may be arrested if code is enforced: Harsono

Politicians says police won't be barging down doors to bust couples in the act — at least, not initially. ( Reuters: Darren Whiteside )

The proposed code also makes it illegal to advocate for birth control, talk about Communism or insult a religious figure.

Mr Harsono says the new laws will create a burden for Indonesian law enforcement.

"Millions of people might be arrested if those articles are enforced," he said.

When asked what happened to Indonesia being a tolerant nation, Mr Harsono replied: "The society is more or less tolerant."

"It has been for thousands of years. But after democracy took place, after the fall of Suharto, there are public openings for Wahabi, Salafi, Hizb ut-Tahrir political thinking," he said.

"Some people call it the Sharia supremacist groups. They are the ones which now dominate the political discourse.

"Quite a lot of people think that it is the right way to be a Muslim."

While the draft criminal code has been agreed upon, the politicians turning it into legislation could take a year or longer.