Three Malaysian Muslim transgenders on Friday won a landmark court ruling that challenged a religious law banning them from cross-dressing. Activists called it a victory for human rights in a conservative Southeast Asian nation.

A three-judge panel of the Court of Appeals unanimously ruled that the Shariah law in Negeri Sembilan state was discriminatory as it failed to recognize men diagnosed with gender identity issues. It said the law deprived transgenders of "the right to live with dignity."

"This is degrading, oppressive and inhumane," said Judge Mohamad Hishammuddin Mohamad Yunus.

Hishammuddin said the Islamic law was aimed at curbing homosexual and lesbian activities that led to the spread of HIV. The present case "has nothing to do with homosexuality," but was about Muslim men with a medical condition, he added.

A lower court dismissed the case in 2012, saying the three transgenders must adhere to Islamic law because they were Muslim and born male. The three, who have been certified by doctors to have gender identity issues, appealed the decision.

The state's Islamic Religious Department could still appeal the ruling at the top Federal Court, although it wasn't immediately clear if it plans to do so.

"We are thankful and overjoyed. It is a victory for human rights," said transgender rights activist Nisha Ayub, who was in court when the verdict was read. She said it left her and her colleagues speechless.

Ayub, who heads the Justice for Sisters group, said the "landmark ruling" had been conveyed to the three transgenders, who were not present in court.

They are makeup artists who had undergone hormone treatment and faced constant harassment from Islamic authorities, she said.

Human Rights Watch calls Muslim-majority Malaysia one of the world's worst countries for transgender people, as they face constant harassment, sexual abuse and arrest by Islamic authorities.

Since the 1980s, every state has passed Shariah criminal enactments that institutionalize discrimination against transgender people, according to the New York-based watchdog.

All 13 Malaysian states prohibit Muslim men from "dressing as women," while three states also criminalize "women posing as men." The laws are enforced by state Islamic Religious Departments.