A Malaysian MP has called for laws that criminalise homosexuality to be immediately abolished amid outcry over the caning of two women convicted by a sharia court of attempting to have lesbian sex.

Charles Santiago, a parliamentary member from the Malaysian state of Selangor, expressed his outrage in a series of tweets after the punishment was carried out in the Terengganu court on Monday morning.

That two women were caned while “100 people gawked at them” in the public gallery of the court was shocking and humiliating, he wrote on Twitter.

“We need to stop targeting the LGBT community. We need to stop invading their privacy. We need to stop abusing them. We need to grow up as a society and learn to embrace diversity,” he wrote.

Santiago said the government was “voted in on the premise of inclusion” and must therefore repeal all laws criminalising homosexuality without delay.

His anger was echoed by other politicians. Khairy Jamaluddin, the MP for Rembau, criticised the punishment on his Twitter account, saying: “Islam teaches us to look after the dignity of every human being.”

“Mercy is preferable to punishment.”

Hannah Yeoh, a member of parliament for Segambut, reacted to the punishment with the statement: “Education doesn’t work this way.”

Homosexuality is illegal in Malaysia and punishable under a colonial-era sodomy law that carries a 20-year prison sentence, while strict Islamic laws that apply to Malaysian Muslims, but not people from other religious backgrounds, prohibit sexual relations between women.

The two women caned on Monday, aged 22 and 32, were arrested by sharia law enforcement officers this April, after they were found attempting to engage in sexual acts in a car.

The sharia high court in Terengganu, a state in Malaysia’s conservative north-east, sentenced the two women to six strokes of the cane and a fine of 3,300 Malaysian Ringgit (£619), after they pleaded guilty to the charges.

Malaysian rights activists believe this is the first time two women have been publicly caned in the country for same-sex relations.

Under Malaysian civil law the caning of women is prohibited, but it is permitted under Islamic law in some states that have adopted concurrent sharia laws.

While activists decried Monday’s caning as a grave violation of human rights, officials in Terengganu claimed the sharia punishment was justified.

“It is more to educate than to harm or hurt,” Satiful Bahri Mamat, a member of the Terengganu state executive council, told a media conference after the sentence was carried out. “I believe we may have received harsher canings when we were in school.”

The public nature of the canings was intended to serve as a “lesson for society”, he said.