BANDA ACEH (AFP) - Two teenagers were whipped in Indonesia's Aceh province on Thursday (Jan 31) 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.

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.

"People outside of Aceh who think Islamic Syariah (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.

But the practice has wide support among Aceh's mostly Muslim population - around 98 per cent 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.