Aceh Ulema Council (MPU) member Mukhlis reacts as he is whipped in public by a member of the Sharia police in Banda Aceh on October 31, 2019. - An Indonesian man working for an organisation which helped draft strict religious laws ordering adulterers to be flogged was himself publically whipped on October 31 after he was caught having an affair with a married woman. (Photo by CHAIDEER MAHYUDDIN / AFP) (Photo by CHAIDEER MAHYUDDIN/AFP via Getty Images)
Aceh Ulema Council (MPU) member Mukhlis reacts as he is whipped in public by a member of the Sharia police in Banda Aceh on October 31, 2019. - An Indonesian man working for an organisation which helped draft strict religious laws ordering adulterers to be flogged was himself publically whipped on October 31 after he was caught having an affair with a married woman. (Photo by CHAIDEER MAHYUDDIN / AFP) (Photo by CHAIDEER MAHYUDDIN/AFP via Getty Images)
PHOTO: CHAIDEER MAHYUDDIN/AFP/Getty Images
Now playing
01:05
Man who helped create caning law gets caned
Now playing
01:01
Watch London police break up an illegal rave
Russia protests Alexey Navalny Putin Pleitgen pkg vpx _00015627.png
Russia protests Alexey Navalny Putin Pleitgen pkg vpx _00015627.png
PHOTO: Reuters
Now playing
02:19
Thousands turn out across Russia to protest Navalny's arrest
PHOTO: FBK
Now playing
02:52
Kremlin critic's investigation into Putin is going viral in Russia
libya russian backed mercenaries wagner investigation npw pkg intl ldn vpx_00001519.png
libya russian backed mercenaries wagner investigation npw pkg intl ldn vpx_00001519.png
Now playing
02:27
Images show huge trench being dug by Russian-backed mercenaries
screengrab who independent panel
screengrab who independent panel
PHOTO: EBS+ News
Now playing
02:34
WHO and China criticized for slow Covid-19 responses
Iraqi security forces keep guard the site of a suicide attack in Baghdad, Iraq January 21, 2021. REUTERS/Thaier al-Sudani
Iraqi security forces keep guard the site of a suicide attack in Baghdad, Iraq January 21, 2021. REUTERS/Thaier al-Sudani
PHOTO: Thaier al-Sudani/Reuters
Now playing
02:42
Dozens killed and hundreds injured in Baghdad suicide blasts
PHOTO: Policia Nacional via Reters
Now playing
00:53
See the aftermath of the Madrid explosion
PHOTO: Alexey Navalny
Now playing
02:35
Navalny urges his supporters to hit the streets
TOPSHOT - Russian President Vladimir Putin crosses himself as he plunges into the icy waters during the celebration of the Epiphany holiday in Moscow region on January 19, 2021. (Photo by Mikhail KLIMENTYEV / SPUTNIK / AFP) (Photo by MIKHAIL KLIMENTYEV/SPUTNIK/AFP via Getty Images)
TOPSHOT - Russian President Vladimir Putin crosses himself as he plunges into the icy waters during the celebration of the Epiphany holiday in Moscow region on January 19, 2021. (Photo by Mikhail KLIMENTYEV / SPUTNIK / AFP) (Photo by MIKHAIL KLIMENTYEV/SPUTNIK/AFP via Getty Images)
PHOTO: MIKHAIL KLIMENTYEV/SPUTNIK/AFP/Getty Images
Now playing
00:36
See Putin take part in traditional icy Epiphany dip
guatemala honduras migrants tear gas Oppmann intl ldn vpx_00000604.png
guatemala honduras migrants tear gas Oppmann intl ldn vpx_00000604.png
PHOTO: CNNE
Now playing
01:30
Authorities use tear gas and batons against US-bound migrants
PHOTO: Getty Images
Now playing
04:21
Here's where the UK-US special relationship could go under Biden
PHOTO: Getty Images
Now playing
02:41
Alexey Navalny arrested on his return to Moscow
PHOTO: Indonesia Search and Rescue Agency
Now playing
02:09
Woman who is trapped underneath earthquake's rubble captured on video
Barrie
Barrie's aunt speaks about how the police brought her the news about the death of her nephew Ibrahima.
PHOTO: VTM
Now playing
01:26
Aunt of Black man who died after arrest in Belgium: We want justice
(CNN) —  

An Indonesian man has been publicly flogged for adultery, under a draconian law he helped create.

Mukhlis, a member of the Aceh Ulema Council (MPU) in the deeply conservative Aceh province of Indonesia, received 28 lashes in front of a crowd on Thursday after being caught having an affair with a married woman. Like many Indonesians, Mukhlis goes by a single name.

His agency advises the local government on drafting and implementing religious laws.

A video by the AFP news agency shows him grimacing as each strike is delivered onto his back by a masked officer on a stage, in front of a handful of onlookers – some of whom filmed on their cell phones. The woman with whom he was caught also received a series of lashes.

Aceh, the country’s only region to impose Sharia law, uses caning to punish a series of offenses, such as homosexuality, drinking alcohol and having sex outside of marriage.

“We have clarified his identity and we proceeded with the investigation and handed over the dossier to prosecutors, and today we carried out the implementation of the flogging punishment,” AFP reported Muhammad Hidayat, the Banda Aceh sharia police chief, as telling reporters at the caning.

“A lot of things we can learn, but ultimately we have to enforce God’s laws, especially on Islamic land like here,” Muhammad Ramdan, a Banda Aceh resident, added.

The state’s Sharia criminal code went into effect in September 2015, and a number of people have been caned under the laws.

Last year 15 people, including five women, received the punishment for a variety of crimes. Before that, two men were lashed 83 times for homosexuality.

“No matter who you are… if you violate (Islamic) law you will be whipped,” Husaini Wahab, the deputy regent of the Aceh Besar municipality, told AFP after the latest caning.

CNN’s Ben Westcott and Euan McKirdy contributed reporting.