Adek Berry, AFP | This general view shows the outside of the Constitutional Court in Jakarta on August 20, 2014

A bid to make all sex outside marriage illegal was rejected by a top Indonesian court Thursday, in a ruling that surprised many as concerns grow about rising intolerance in the world's biggest Muslim-majority country.

Advertising Read more

Five out of nine judges on the Constitutional Court in the capital Jakarta narrowly rejected the push to criminalise extramarital relations, including gay sex.

The unsuccessful petition would have affected both unmarried heterosexuals and gay people, who cannot marry in Indonesia.

It comes several months after the arrests of a group of men accused of holding a "gay party" and a wave of anti-LGBT rhetoric.

"This is a victory not only for LGBT communities, it's a victory for common sense," said gay rights activist Hartoyo, who like many Indonesians goes by one name.

"We live together as a nation and we must respect our differences," he added.

The court had been hearing a judicial review filed by Islamic activist group the Family Love Alliance that sought to alter the criminal code.

It argued that the influence of the gay community has been spreading, particularly since the United States legalised same-sex marriage, resulting in what it called "moral degradation".

Activists believe the US decision triggered a backlash in Indonesia, including government ministers publicly making anti-gay statements.

"Of course I'm sad... We know exactly the magnitude of this problem -- extramarital affairs and same-sex relationships," said a weeping Euis Sunarti, who was one of the applicants behind the criminalisation bid.

"Many people will be disappointed with this ruling."

'Seemingly impossible'

In its decision, the court said it had no authority on the matter since passing new laws was the job of Indonesia's parliament.

"The Constitutional Court cannot intervene in the politics of the penal code," it added.

But last month, the same court ruled that Indonesia's native faiths should be recognised by the government.

That ruling challenged a law requiring millions of followers of religions other than six officially recognised faiths to leave the line for religion blank on their national identity cards, limiting their access to public services, including education and medical care, as well as employment opportunities.

Still, some observers were surprised by the court's decision on Thursday.

"Just when you think this country is rotten, it pulled (off) the seemingly impossible. Hope is here," writer Alexander Thian said on Twitter.

Indonesia's justice system is notoriously corrupt and has been criticised for favouring religious-based arguments over legal reasoning in the past.

Gay sex vigilantes

Sex is only illegal in Indonesia for both homosexual and heterosexual people if it involves a minor.

However, gay sex is a crime in the conservative province of Aceh, which upholds sharia law, with those caught facing up to 100 strokes of a cane.

Aceh, on Sumatra island, began implementing Islamic law after being granted special autonomy in 2001, an attempt by the central government to quell a long-running separatist insurgency.

This year, two men having sex were caught by a group of vigilantes who raided a boarding house in Aceh.

In May, police arrested a group of men holding a party in two hotel rooms in Surabaya, Indonesia's second-biggest city.

Some of the men were watching gay porn and performing "deviant sexual acts", police said, charging some under Indonesia's tough anti-pornography law, which can result in long jail sentences.

Outside Aceh, Indonesia's current laws on homosexuality are more liberal than some of its neighbours, however.

In Singapore sex between men remains illegal, a holdover from colonial rule that is not strictly enforced. In Malaysia sodomy is a criminal offence and can result in imprisonment, corporal punishment, and fines.

Indonesia has often been praised for its moderate inclusive brand of Islam.

Still, the diverse archipelago's sizeable religious minorities -- mainly Christians and Muslim minority Shiites and Ahmadis -- have been increasingly targeted in recent years.

(AFP)

Daily newsletterReceive essential international news every morning Subscribe