BANDA ACEH, Indonesia — 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 receive 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.

The couple was arrested in late March after neighborhood vigilantes in the provincial capital, Banda Aceh, suspected them of being gay and broke into their rented room to catch them having sex.

Cellphone video 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, cooperated 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 described the treatment of the men as abusive and humiliating and called for their immediate release.