Two teenagers were whipped in Indonesia’s Aceh province on Thursday after they were caught cuddling in public — a crime under the conservative region’s Islamic law.

Flogging is used as punishment for a range of offences in the region at the tip of Sumatra island, including gambling, drinking alcohol, and having gay sex or relations outside of marriage.

An 18-year-old Indonesian woman (centre R) is caned in public in Banda Aceh on January 31, 2019, as punishment for being caught cuddling with her boyfriend. // AFP PHOTO

Hundreds of spectators watched as a female university student and her boyfriend, both 18, were whipped 17 times each outside a mosque in the provincial capital Banda Aceh.

A 35-year-old man was also flogged with a rattan cane for being intimate with a woman — aged 40 — in a local grocery store.

All four had served several months in prison before the punishment.

On Thursday, the 40-year-old woman pleaded to be caned in an apparent attempt to get out of jail immediately, but a medical team postponed her flogging after they deemed her physically unfit.

Aceh is the only province in the world’s biggest Muslim majority country that imposes Islamic law.

An Acehnese man (R) is caned as punishment for having a sexual relationship outside of marriage in Banda Aceh, Aceh, Indonesia, 31 January 2019.// EPA-EFE PHOTO

“People outside of Aceh who think Islamic Sharia (law) is cruel can now see that it is actually very tolerant and humane,” Banda Aceh deputy mayor Zainal Arifin told reporters.

In December, two men caught having sex with underage girls were whipped 100 times each.

Rights groups slam public caning as cruel, and Indonesia’s President Joko Widodo has called for it to end.

An 18-year-old Indonesian woman (C) is assisted by Sharia police after being caned in public in Banda Aceh on January 31, 2019, as punishment for being caught cuddling with her boyfriend. // AFP PHOTO

But the practice has wide support among Aceh’s mostly Muslim population — around 98 percent of its five million residents practise Islam.

Earlier this year, Aceh said that flogging would be carried out behind prison walls in future, but some local governments have continued public whippings.

Aceh adopted religious law after it was granted special autonomy in 2001, an attempt by the central government to quell a long-running separatist insurgency.