KUALA LUMPUR, Malaysia — Two Malaysian Muslim women convicted under Islamic laws of attempting to have sex were caned Monday in a rare public whipping that was slammed by lawmakers and rights activists as a form of torture.

Lawyers and activists said the women, ages 22 and 32, were seated on stools facing the judges and given six strokes from a light rattan cane on their backs by female prison officers. More than 100 people witnessed the caning in a Shariah courtroom in northeast Terengganu state, they said.

Muslim Lawyers’ Association deputy president Abdul Rahim Sinwan said unlike caning under civil laws, the punishment under Islamic laws isn’t painful or harsh and was meant to educate the women so they will repent. The women, dressed in white headscarves and clothing, didn’t cry or scream but “showed remorse,” he said.

“Repentance is the ultimate aim for their sin,” he said.

Human rights groups slammed the punishment and said it could worsen discrimination against people in Malaysia’s lesbian, bisexual, gay and transgender community.

“Caning is a form of cruel, inhuman and degrading treatment and may amount to torture,” Amnesty International Malaysia said in a statement. “People should not live in fear because they are attracted to people of the same sex. The Malaysian authorities must immediately repeal repressive laws, outlaw torturous punishments and ratify the U.N. Convention Against Torture.”

Malaysia follows a dual-track justice system. Nearly two-thirds of Malaysia’s 31 million people are Muslims, who are governed by Islamic courts in family, marriage and personal issues. The two unidentified women were discovered by Islamic officials in April and sentenced last month by a Shariah court to six strokes of a cane and a fine after pleading guilty.

Justice for Sisters group member Thilaga Sulathireh, who witnessed the caning, said she was shocked by the public spectacle. She said Malaysian laws were inconsistent because civil laws prohibit corporal punishment against female prisoners.

“It’s a regression of human rights in Malaysia. It’s not about the severity of the caning. Corporal punishment is a form of torture regardless of your intention,” she said.