A group of unmarried couples were publicly whipped in Indonesia’s religiously conservative Aceh province after they were caught behaving amorously — a crime under the region’s unsparing application of Islamic law.

The six couples flogged Thursday received between four and 22 strokes each from a rattan cane outside a mosque in the provincial capital, Banda Aceh, after they were seen by religious police showing affection in public.

Hundreds of spectators gathered to watch the public flogging, including children. They all watched as a masked sharia officer lashed the offenders as they cried out in pain, with two women being so severely injured they were left unable to walk after the punishment had been administered.

“We hope in the future there will be no more cases like this — it’s embarrassing,” said religious officer Safriadi, who goes by one name.

This is not the first time Aceh province has chosen to publicly punish offenders it deems to have insulted Islamic law.

Flogging is common for a range of offences in the region at the tip of Sumatra island, including gambling, drinking alcohol, and having gay sex.

It is the only province in the world’s biggest Muslim-majority country that imposes Islamic law and uses caning as a public humiliation.

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

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.

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

Aceh is known as the “Gateway to Mecca,” both because it is the westernmost tip of the Indonesian archipelago and thus a good starting point for the Islamic pilgrimage (hajj) and because of its long association with Islam.

As Breitbart News reported, Banda Aceh banned celebrations of Valentine’s Day in 2017, contending that the holiday violates Islamic law.

“Our society and the Muslim youth should certainly not be celebrating non-Islamic holidays,” declared Mayor Illiza Saaduddin Djamal. “The law says it is haram. The government is obliged to protect the public and younger generation from unlawful acts.”

AFP contributed to this report