An Indonesian man who worked for a clerical organisation that advises a local government on Islamic law has been caned in public for adultery.

Mukhlis bin Muhammad, 46, a member of the Aceh Ulema Council (MPU), was caned 28 times on Thursday in a public park by a religious officer, an official said.

He had a sexual relationship with a married woman, who was also flogged in public and received 23 lashes.

The punishments took place in ultra-conservative Aceh, the sole province in Indonesia - the world's largest Muslim-majority nation - that applies sharia law. It was granted autonomy in 2001.

Public floggings and canings - which many Acehnese support - have become common there since they were introduced in 2005, and are administered for a range of offences also including theft and gambling. The province outlawed homosexuality in 2014.

MPU advised the Aceh government in drafting its current version of sharia. Muhammad's role in the organisation was not disclosed.

Mukhlis bin Muhammad was caned 28 times in a public park. Source: AFP via BBC More

Husaini Wahab, a senior official in Aceh Besar district, said canings were meant to serve as a reminder to locals to adhere to the Islamic criminal code.

"It doesn't matter whether he is an ulema, an imam, or an ordinary citizen, the government does not discriminate," he said, adding that Muhammad could no longer belong to the MPU.

Rights groups have called for public floggings and canings to be discontinued.

Papang Hidayat, a researcher with Amnesty International, said they violated human rights. "Showing consensual affection should not be criminalised," he said.

Indonesia is home to a number of religious and ethnic minorities and has been seen as an example of how democracy and Islam can co-exist.

But rising conservatism has in recent years spurred religious intolerance there.

Do you have a story tip? Email: newsroomau@yahoonews.com.

You can also follow us on Facebook and Twitter, download the Yahoo News app from the App Store or Google Play and stay up to date with the latest news with Yahoo’s daily newsletter. Sign up here.