An Indonesian man working for an organisation which helped draft strict religious laws ordering adulterers to be flogged was himself publically whipped on Thursday after he was caught having an affair with a married woman.

Flogging is a common punishment for a range of offences in the deeply conservative Aceh region on Sumatra island - including adultery, drinking alcohol, and having gay or pre-marital sex.

Aceh is the only region in the world's biggest Muslim-majority nation that imposes Islamic law, part of a 2005 autonomy deal with the central government that ended a decades-long separatist insurgency.

READ MORE Anger as Indonesia moves to criminalise sex outside marriage

On Thursday, a masked religious officer rained down 28 lashes on the back of Aceh Ulema Council (MPU) member Mukhlis after he was caught canoodling with a married woman last month.

Mukhlis, who like many Indonesians goes by one name, grimaced and flinched during the punishment in the provincial capital Banda Aceh, before his married companion was flogged with a rattan cane some 23 times.

The organisation that Mukhlis works for advised the local government and legislature on drafting and implementing Aceh's religious law, including public flogging.

It was not immediately clear what he did for the agency.

Getty

The council made headlines this summer when it hit out at plans to form a national women's football league because Aceh did not have a special stadium where only women players, match officials and spectators would be present.

In June, it issued a fatwa, or religious edict, against online game PlayerUnknown's Battlegrounds (PUBG), saying it insulted Islam and made addicted players violent.

Flogging a council member underlined the commitment to enforcing Islamic law, said Aceh Besar deputy regent Husaini Wahab.

"No matter who you are... if you violate (Islamic) law you will be whipped," he told reporters after the punishment.

Mukhlis would likely be sacked under his employer's moral code, Mr Wahab added.

Getty

Also on Thursday, a female university student was flogged a dozen times after she was caught spending the night in a boarding house with a man, who escaped punishment because he was underage.

Dozens of onlookers watched the floggings, with some recording them on their mobile phones.

"I was just curious to see how it was carried out," said one spectator.

In July, three people were flogged 100 times each for having premarital sex, while last year, two men caught having sex with underage girls were also whipped 100 times.

Rights groups have slammed public caning as a cruel and inhuman punishment, and Indonesia's President Joko Widodo has called for it to end.

But the practice has wide support among Aceh's mostly Muslim population.