An Indonesian woman is whipped in public on charges of engaging in sexual relations, in Aceh Timur.

An Indonesian man who fainted as he was being whipped for pre-marital sex Thursday was revived to receive the rest of his punishment before being rushed to hospital.

Despite international condemnation, public flogging is common for a range of offences banned under local Islamic law in the conservative Aceh region on Sumatra island, including gambling, drinking alcohol, and having gay or pre-marital sex.

Aceh is the only region in Indonesia, the world's biggest Muslim-majority country, that imposes religious law.

On Thursday, a 22-year-old man -- sentenced to 100 strokes -- pleaded with a masked Sharia officer to stop lashing his back with a rattan cane before he fainted.

He was revived and given brief medical attention and then the flogging continued. He was later rushed to a nearby hospital for treatment.

The man had been found guilty of having sex with a woman who was also sentenced to 100 lashes outside a mosque in Aceh Timur district, along with another man she had relations with.

Some 500 jeering spectators watched the punishment as some yelled "harder, harder".

"This is the consequence they have to face for violating the law," onlooker Muhammad Yunus told AFP.

In July, three people were flogged 100 times each for having premarital sex, while two men caught having sex with underaged girls were also whipped 100 times last year. Other offences tend to carry dozens or even fewer lashes.

In October, Aceh officials announced that poachers who threaten endangered orangutans, tigers and other wildlife could receive up to 100 lashes under new rules.

Rights groups have slammed public caning as cruel, and Indonesia's President Joko Widodo has called for it to end, but the practice has widespread support among Aceh's mostly Muslim population.