KUALA LUMPUR (Reuters) - Malaysian Prime Minister Mahathir Mohamad on Thursday denounced the caning of two Muslim women for attempting lesbian sex, a sentence that sparked outrage and raised fears about the treatment of the lesbian, gay, bisexual and transgender (LGBT) community.

FILE PHOTO: Malaysia's Prime Minister Mahathir Mohamad speaks during a news conference with China's Premier Li Keqiang at the Great Hall of the People in Beijing, China, August, 20, 2018. How Hwee Young/Pool via REUTERS

The women had pleaded guilty to charges under Islamic laws forbidding lesbian sex. They were caned on Monday in front of dozens of people at a sharia court in Terengganu, a conservative state in the east, prompting an outcry from human rights activists, who described the punishment as torture.

Mahathir’s government has appeared divided about the LGBT community, while the premier himself had been silent on the caning and recent attacks on transgender people and marginalized groups in the Muslim-majority country.

In a video posted on his Twitter account, Mahathir said the caning “did not reflect the justice or compassion of Islam”.

It was the women’s first offence, he said, which warranted a lighter sentence, such as counseling.

“This gives a bad impression of Islam,” the 93-year-old leader said. “It is important that we show Islam is not a cruel religion that likes to impose harsh sentences to humiliate others.”

The LGBT community is routinely persecuted in Malaysia, where it is seen as a threat to conservative values.

Mahathir’s government swept into power in May after campaigning on a reform agenda, but has been unconvincing in its handling of matters relating to race, religion and minorities in the multi-racial country.

The caning followed a series of incidents in recent weeks that civil rights groups say illustrate growing hostility against gay and transgender people.

Last month, a gay bar in Kuala Lumpur was raided by police and religious enforcement officials, while a transgender woman was beaten up by a group of assailants in Seremban, near the capital.

The minister in charge of Islamic affairs also came under fire, including from other ruling party lawmakers, after he ordered the removal of portraits of two LGBT activists from an art exhibition.

Malaysia describes oral and anal sex as against the order of nature. Civil law stipulates jail for up to 20 years, caning and fines for offenders, although enforcement of the law is rare.

Muslims are also governed by state-level Islamic laws, most of which carry provisions outlawing same-sex acts.