A Hong Kong law that stipulates life imprisonment for gay male sex is unconstitutional and discriminates against gay men, a judge has ruled.

Judge Michael Hartmann said laws that outlaw sexual relations between men if one or both partners are less than 21 were demeaning of gay men who, through the legislation, are stereotyped as deviant.

The High Court judgement follows a challenge to the laws by 20-year-old Hong Kong resident William Leung, Australian Associated Press reported.

Under current Hong Kong law, gay male sex is punishable with life imprisonment if either man is under 21.

The age of consent for heterosexual or lesbian sex is 16, 365Gay.com reported.

And while heterosexual sodomy is also illegal, Hartmann said, only the male partner is liable.

The judge said the gay sex laws clashed with Hong Kong’s Basic Law -“ similar to a constitution -“ and the territory’s Bill of Rights.

According to human rights commentators, Hartmann’s ruling amounts to a negation of the gay sex law, but an appeal is possible, Australian Associated Press reported.

Leung and local gay activists welcomed the ruling, which follows recent criticism of Hong Kong’s record on gay rights.

I can finally have a loving relationship without being scared of (being) thrown into jail for life imprisonment, Leung said.

Hong Kong gay activist Roddy Shaw said the judgment was a landmark.

It is a landmark case and a long overdue judgment, Shaw said.

It’s the first time that sexual orientation has been upheld as a protected ground against discrimination in a Hong Kong court.

© Star Observer 2018 | For the latest in lesbian, gay, bisexual, trans* and intersex (LGBTI) news in Australia, be sure to visit starobserver.com.au daily. You can also read our latest magazines or Join us on our Facebook page and Twitter feed.