Hundreds of people gathered outside a mosque in Indonesia to see a woman scream out in agony after being caned as a punishment for being in 'close proximity' to a man she wasn't married to.

Nur Elita was marched to the yard of Baiturrahumim Mosque in Banda Aceh for violating the region's strict Sharia laws, after she allegedly showed affectionate behaviour to a fellow university student.

Under the law men and women, who are not spouses, are not allowed to get too close due to the 'khalwat' offence and punishment is by public caning.

Scroll down for video

The woman is brought to the stage by two female members of the Sharia Police and is put in position on her knees

She screams out in agony after being whipped in a caning ceremony outside a mosque in Indonesia's Banda Aceh region

The woman was forced to endure the punishment after breaking the region's strict Sharia law on being to close to a man she was not married to

After being brought to the stage as the crowd cheered, the woman was forced to kneel down while a masked man repeatedly whipped her with the cane

Hundreds of people gathered outside the mosque in Banda Aceh to watch the caning, with some spectators holding up cameras

In total, the woman received five lashes from the masked man who carried out the caning outside the mosque

After being brought to the stage as the crowd cheered, the woman was forced to kneel down while a masked man repeatedly whipped her with the cane.

She received five lashes and at the end of the punishment could be seen lying on the floor doubled over in pain.

Eventually she was carried off the stage, into an ambulance, and had to be taken to hospital.

The man carrying out the public punishment wore a masked outfit as he caned the woman on the back and shoulders

After her punishment was over the young woman collapsed and could be seen lying on the floor in agony

Despite the punishment being over, she was unable to rise to her feet and was seen lying down clutching her shoulder

She was eventually picked up by officials and carried to a waiting ambulance, where she had to be taken to hospital for treatment

Also being caned was the man she was accused of getting too close to and he was forced to stand while being whipped.

Meanwhile four other men were also forced to endure the punishment for gambling, which is also outlawed under Sharia law.

According to the Jakarta Post, the caning ceremony was carried out in front of the deputy mayor of Banda Aceh Zainal Arifin.

The man that she was accused of getting close to was also brought to the stage afterwards and received the same punishment, pictured

The man was forced to stand as he also received five lashes to his back for breaking strict Sharia law

The masked man, a member of the Sharia Police receives the cane he uses to carry out the public punishment

And before the ceremony he warned the crowd that had gathered that the canings were a lesson to everyone.

He said: 'Take these punishements as a lesson. What has been done by these convicts should not be taken as example.

'And I hope their canings today will be the last ever.'

Banda Aceh is the only province in Indonesia to implement Sharia Law, which was first introduced in 2003 following the province’s awarding of special autonomy status.

As well as the couple, four other men were also caned after being found gambling, which is banned under Sharia law

The men were forced to stay on their feet before each being caned five times in front of the cheering crowd

Banda Aceh is the only province in Indonesia to implement Sharia Law, which was first introduced in 2003. Pictured is a man who was accused of violating gambling laws