An Islamic Shariah court in Indonesia's conservative Aceh province has sentenced two gay men to public caning for the first time, further undermining the country's moderate image after a top Christian politician was imprisoned for blasphemy.

The court, whose sentencing Wednesday coincided with International Day Against Homophobia and Transphobia, said the men, aged 20 and 23, would each be subjected to 85 lashes for having sexual relations. One of the men wept as his sentence was read out and pleaded for leniency.

The chief prosecutor, Gulmaini, who goes by one name, said they will be caned next week, before the holy Muslim month of Ramadan starts about May 25.

A police officer escorts the two men into a holding cell to wait for the start of their trial in Shariah court on Wednesday. (Henri Juanda/Associated Press)

The couple was arrested in late March after neighbourhood vigilantes in the provincial capital Banda Aceh suspected them of being gay and broke into their rented room to catch them having sex. Mobile phone footage that circulated online and formed part of the evidence shows one of the men naked and visibly distressed as he apparently calls for help on his cellphone. The second man is repeatedly pushed by another man who is preventing the couple from leaving the room.

The lead judge, Khairil Jamal, said the men were "legally and convincingly proven to have committed gay sex."

He said the three-judge panel decided against imposing the maximum sentence of 100 lashes because the men were polite in court, co-operated with authorities and had no previous convictions.

"As Muslims, the defendants should uphold the Shariah law that prevails in Aceh," Jamal said.

International human rights groups have described the treatment of the men as abusive and humiliating and called for their immediate release. Human Rights Watch said in April that public caning would constitute torture under international law.

Prosecution 'very harsh'

Prosecutors had asked that they receive 80 lashes and said the men had waived their right to defence lawyers. It was not clear why but guilty verdicts are certain in most cases that reach the Shariah court.

"The prosecution is very harsh. The verdict is harsher," said Andreas Harsono, Indonesia researcher for Human Rights Watch. "It shows the increasingly conservative judiciary in Indonesia," he said.

Aceh is the only province in Muslim-majority Indonesia allowed to practice Shariah law, which was a concession made by the national government in 2006 to end a war with separatists, but some other areas have introduced Shariah-style bylaws.

Aceh implemented an expansion of Islamic bylaws and criminal code two years ago that extended Shariah law to the province's non-Muslims and allows up to 100 lashes for morality offences including gay sex and sex between unmarried people.

Human Rights Watch says the Aceh laws violate the International Covenant on Civil and Political Rights, which Indonesia ratified in 2005.

Caning is also a punishment in Aceh for gambling, drinking alcohol, women who wear tight clothes and men who skip Friday prayers. More than 300 people were caned for such offences last year.

Homosexuality is not illegal elsewhere in Indonesia but a case before the country's top court is seeking to criminalize gay sex and sex outside marriage.

Indonesia's reputation for practising a moderate form of Islam has been battered in the past year due to attacks on religious minorities, a surge in persecution of gays and a polarizing election campaign for governor of the capital Jakarta that highlighted the growing strength of hard-line Islamic groups.

Earlier this month, the outgoing Jakarta governor, a minority Christian, was sentenced to two years in prison for campaign comments deemed as blaspheming the Qur'an.​