HONG KONG — A Hong Kong court ruled Friday against allowing same-sex unions in the city, a setback for efforts to broaden recognition of such partnerships in Asia.

The decision by Hong Kong’s Court of First Instance upheld a government policy prohibiting such unions. It came five months after Taiwan’s government became the first in Asia to legalize same-sex marriages, stirring hope among many that other places in the region would follow suit.

In the ruling Friday, Judge Anderson Chow wrote that “updating” the definition of marriage to include same-sex couples would lead to “far-reaching consequences” that the court was not prepared to accept.

He said it was “beyond the proper scope of the functions or powers of the court, in the name of interpretation, to seek to effect a change of social policy on such a fundamental issue.”