BANDA ACEH - An Indonesian man collapsed while being publicly caned Monday for spending time with a woman who is not his wife in Muslim part of the country.

Herizal bin Yunus, 27, fainted after being caned eight times in front of a crowd in Aceh, the only province of the world's most populous Muslim-majority country that imposes sharia law.

Officials carried him off stage after he collapsed during the punishment outside a mosque in the provincial capital Banda Aceh, which was carried out by a religious official dressed in an all-encompassing, hooded cloak.

But once he came to, a doctor examined him and said he was in good health, and he was taken back up on stage to be flogged another 14 times. A local religious court had sentenced him to be caned a total of 22 times. The man had broken Islamic laws that forbid people in Aceh from spending time in close proximity with members of the opposite sex who are not their husband or wife.

He was one of eight people publicly caned on Monday for breaking the province's Islamic regulations.