Indonesian authorities have publicly caned eight men who were convicted of gambling in conservative Aceh province.

About a thousand people watched as the eight men were caned inside a mosque compound after Friday prayers in the provincial capital, Banda Aceh.

An official said police arrested nine people who were gambling in July and seized about $130 in cash from them, but one could not be caned because of his health condition.

A state prosecutor read out their punishment, and a masked man wearing robes used a thin rattan cane to whip their backs five times each.

Indonesia, the world's most populous Muslim nation, has a policy of secularism but allows Aceh on Sumatra island to follow a version of Islamic Shariah law. The law forbids gambling.