An Indonesian man who works for a group that helped draft strict adultery laws was publicly whipped 28 times — after being caught having an affair with a married woman, according to reports.

A masked religious official flogged Aceh Ulema Council member Mukhlis bin Muhammad on the back on Thursday for his extramarital fling with the woman, who was then caned 23 times, according to the Guardian.

Flogging is a common punishment in the deeply conservative Aceh region on Sumatra island — the only place in Indonesia that practices Sharia, or strict Islamic law — including for offenses such as adultery, drinking alcohol and having gay sex.

“This is God’s law. Anyone must be flogged if proven guilty, even if he is a member of the MPU,” Aceh Besar Deputy Mayor Husaini Wahab told the BBC, referring to the council, from which he’ll be expelled.

Mukhlis, 46, who is the first Islamic religious leader to be publicly caned in Aceh since Sharia law went into effect in 2005, grimaced and flinched as his punishment was meted out in the provincial capital of Banda Aceh.

The couple apparently were caught in a car parked near a tourist beach in September.

The organization Mukhlis works for advised the local government and legislature on drafting and enforcing religious law, including public floggings.

The council made headlines recently when it assailed plans to form a national women’s soccer league because Aceh did not have a special stadium where only female players, match officials and spectators would be present.

Also on Thursday, a female university student received a dozen whips after she was caught spending the night in a boardinghouse with a man, who escaped punishment because he was underage.

Dozens of onlookers watched the public lashings, with some recording them on their cellphones.

“I was just curious to see how it was carried out,” said one spectator, Robbi.