A video recording of Indonesian vigilantes detaining two young gay men captures them kicking, slapping and insulting the pair, shortly before they are turned over to the province's religious police.

Key points: Detained men face maximum penalty of 100 strokes of cane

Detained men face maximum penalty of 100 strokes of cane Rights groups say discrimination against minorities increasing in Indonesia

Rights groups say discrimination against minorities increasing in Indonesia Religious police in Banda Aceh enforce province's strict sharia law

The young men, aged 20 and 23, have already been held in custody for 10 days and are likely to be the country's first gay couple to face trial for breaching religious laws.

In the latest example of Indonesia's growing religious conservatism, the men will be caned if convicted and face a maximum penalty of 100 strokes.

The shaky cell phone video shows a naked young man slumped on the floor, making a desperate phone call.

"Brother, please help, please help, please help us," he says.

In the background a shirtless young man tries to leave the room. He is pushed roughly away from the door.

The man on the floor is slapped, then kicked.

"Brother we got busted having sex," he says, on the phone.

Banda Aceh's head of investigations for the Sharia Police, Marzuki Ali, said the people who detained the pair on March 28 were neighbours of the men who were suspicious of the couple.

In the video, the religious policeman giggles as he describes their capture.

"Because of the suspicion, at around 11:00pm the locals raid the house, and they caught them having anal sex, through the 'back door'," he said.

More than 300 people were caned in Aceh last year for so-called moral offences. ( AP: Heri Juanda )

The video captures the neighbours calling one of the men "a dog" — a particularly offensive insult to any Muslim.

One of the crying young men pleads: "Brother please don't report me."

"You are a man," says his accuser. "Why do you look like this?"

Human rights group calls for President's intervention

Banda Aceh's religious police enforce the province's strict sharia code.

Andreas Harsono, from the group Human Rights Watch, said the code against gay sex was passed in 2014, but until now authorities had not had enough evidence to charge anyone.

"Obviously it's not easy to catch a couple involved in a sexual act … This is the first case ever in Aceh," he said.

If the men are convicted and caned, they will join the 339 people who were flogged in Aceh last year for so-called moral offences, like gambling, drinking, or spending time in private with a member of the opposite sex.

The ABC witnessed one of those canings in the Aceh town of Jantho — an 18-year-old woman who received nine strokes after she was caught alone in a room with her boyfriend.

The teenager was caned outside a mosque after Friday prayers and had to be helped off the stage after her ordeal.

Loading

Human Rights Watch has asked President Joko Widodo to intervene in this latest case.

"I hope President Jokowi says something against this. It is against the constitution, it is torture," Mr Harsono said.

"This is a small part of growing discriminatory in Indonesia.

"Over the last 15 years we are seeing more and more discrimination against minorities and gender minorities including women."

Mr Harsono said local sharia codes were spreading across Indonesia. They cover everything from sex outside marriage to the type of hijab and clothing a woman must wear.

"It is not just Aceh. There is now mandatory hijab in one-fifth of all Indonesian regencies. Of Indonesia's 514 regencies and cities more than 130 have mandatory hijab regulations," he said.

The men caught in Banda Aceh will remain in custody until their trial.