A public caning of two Muslim women in Malaysia for attempting to have sex was criticised by the country’s Prime Minister Mahathir Mohamad. He said it tarnished Islam’s reputation as a merciful and compassionate religion.

The two women were caned on September 3. According to Mahathir, who discussed the matter with his cabinet on September 6. He said he felt the caning “did not reflect the justice or compassion of Islam.”

He said the women could have been given a lighter sentence and counselling since it was their first offence.

“It gives a bad image to Islam,” Mahathir said in a video posted on social media. “It is important for us to show that Islam is not a vicious religion that likes to punish and humiliate people.”

As reported by The Associated Press (AP), Mahathir, who won a stunning election victory in May, said Muslims greet each other “in the name of Allah who is most merciful and compassionate” but the caning gave a message that there was no mercy in Islam.

The women, aged 22 and 32, were arrested in April and pleaded guilty in an Islamic court. They were given six strokes by a light rattan cane on their covered backs by female prison officers in a Shariah court in northeast Terengganu, a state ruled by a conservative Islamic party.

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

The European Commission issued the following statement: “This constitutes a breach of their human rights and a form of torture. The rights of lesbian, gay, bisexual, transgender and intersex (LGBTI) persons are protected under existing international human rights law and relevant international conventions without discrimination.”

However, homosexual activity is illegal under both Islamic and Malaysian secular laws, which are seldom enforced. Women cannot be whipped under civil laws.

According to AP, the caning occurred amid a climate of fear and discrimination against Malaysia’s LGBT community. A few weeks ago, authorities removed the portraits of two LGBT rights activists from a public exhibition. Malaysia religious minister Mujahid Yusuf later said the government doesn’t support the promotion of LGBT culture.