Hong Kong’s top court has ruled in favour of giving same-sex couples legal recognition, though stopped short of demanding full marriage equality.

The Court of Final Appeal on Tuesday, 4 September said that the government was violating the city’s Bill of Rights by not providing an “alternative framework” for the legal recognition of same-sex partnerships.

Five judges handed down the decision after years of legal battles challenging the government’s refusal to allow same-sex marriage or civil unions.

Their ruling said the legal recognition of same-sex couples will “provide them with a sense of legitimacy, dispelling any sense that they belong to an inferior class of persons whose relationship is undeserving of recognition.”

The government now has two years to comply with it.

READ MORE: Hong Kong’s top court sides with trans community in ID card case

The victory is, however, a partial one as the court unanimously dismissed an attempt to recognise overseas-registered same-sex marriage for all citizens in the region.

LGBTQIA+ activists had been hoping it would rule that denying such partnerships is a breach of equal rights protections.

Same-sex activity was legalised in Hong Kong in 1991, but same-sex marriages and unions are still now allowed.