A transsexual's bid to marry her boyfriend has been rejected by the High Court.
But in putting a block on marriage lines, Justice Andrew Cheung Kui-nung told the government not to see the verdict as a victory.
He urged it to seek public views on similar sensitive gender issues.
The Chinese woman - "W" under anonymity rules - said she is "confused and disappointed" by the decision and plans to fight on for rights in her new gender.
In dismissing W's application for a judicial review, Justice Cheung said there had been insufficient evidence in the case "to demonstrate a shifted societal consensus in present-day Hong Kong regarding marriage to encompass a post-operative transsexual."
He also said no general consensus has been reached or is emerging from among contracting parties to the International Covenant on Civil and Political Rights.
Justice Cheung added that "the court must not rush to substitute its own judgment in place of ... the government or legislature in Hong Kong."
It "is certainly hoped that the government will not view the result of this litigation as simply a victory; particularly not as a victory over those who have the misfortune to be suffering from transsexualism," he wrote in his judgment.
"Rather, it is hoped that this case will serve as a catalyst for the government to conduct general public consultation on gender identity, sexual orientation and the specific problems and difficulties faced by transsexual people, including their right to marry."
For W, however, the fight is still on. She will "legally" marry her boyfriend in Hong Kong no matter what it takes, she vowed.
"I'm not going to get married elsewhere. I am a Hong Kong resident and it is my right to marry my beloved boyfriend here.
"Transgendered people are being discriminated against by Hong Kong law.
"On the one hand, the government gave me hope as I received a subsidy for my operation and was allowed to change the gender on my identity card and school certificates.
"On the other hand, I was prevented from marrying my boyfriend."
Her solicitor, Michael Vidler, then came in with some clarification.
W had approached him, Vidler said, and his advice was that she would be breaking the law by marrying a man.
"She didn't go to the marriage registry but approached me for legal advice," he said.
"I wrote to the registry, telling them about W's case. That was when she was told transgender people are not allowed to get married.
"The registry needs only a person's identity card - not birth certificate - for marriage registration."
Civic Party lawmaker and barrister Ronny Tong Ka-wah said he supports the right of transsexuals to marry as he believes the law should keep pace with changes in society. But he doubts political parties will support the idea as society is divided on the issue.
The chairman of the Democratic Alliance for the Betterment and Progress of Hong Kong, Tam Yiu-chung, said the issue is indeed controversial. In fact, he said, the government must be careful when mulling over whether to launch a transgender consultation.
Jimmy Sham Tsz-kit, a member of Rainbow Action, which champions the rights of sexual minorities, said he is angry as the court has shifted responsibility to the government.
A spokesman for the government said it welcomes the judgment.