Three Malaysian Muslim transgenders have won a court bid to challenge a religious law that bans them from cross-dressing.

The Court of Appeals said Friday that the Shariah law in Negeri Sembilan state is discriminatory as it fails to recognize men diagnosed with gender identity issues.

Judge Mohamad Hishammuddin Mohamad Yunus called the law "degrading, oppressive and inhumane."

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 appealed the decision.

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