Taiwan has become the first state in Asia to recognise gay marriage as its top court in a landmark ruling on Wednesday (24 May) legalised same-sex unions.

The constitutional court said Taiwan's current law – which states that marriage is between a man and a woman – "violated both the people's freedom of marriage ... and the people's right to equality".

The Taiwanese parliament will now be forced to change the existing law or pass new separate civil partnership legislation.

The court has given the Tsai Ing-wen government two years to implement the ruling. However, if parliament does not make the changes within two years, same-sex couples can go ahead and still register their marriage based on the court's interpretation, the court said.

"The current provisions of the marriage chapter do not allow two persons of the same sex to create a permanent union of an intimate and exclusive nature for the committed purpose of managing a life together. This is obviously a gross legislative flaw," a statement from the court said.

The decision to allow same-sex couples to marry would protect "human dignity" and contribute to social stability, the court ruled, according to The Telegraph.

Cases challenging the law were brought by long-time LGBT rights activist Chi Chia-wei and the Taipei City Government after the former's attempt to register his marriage with his same-sex partner was rejected in 2013. He made his first appeal for recognising gay marriage in 1986.

The city government filed the petition due to growing requests for gay marriages, local media reported.

Public hearing in the case began in March. The ruling on Wednesday comes as the gay community is reported to be facing increasing persecution in the country.

Taiwan same sex marriage ruling
Taiwan's veteran gay rights activist Chi Chia-wei (C) says he is 100% confident about a positive outcome of a court ruling allowing same-sex marriage SAM YEH/AFP/Getty Images

With growing momentum behind the push for marriage equality, activists were optimistic about the decision, especially since President Tsai Ing-wen openly voiced her support for the move.

However, the debate on bringing changes to the law has left the island nation divided with conservative groups staging mass rallies in recent months.

A majority of at least 10 out of 14 judges were needed to agree on the ruling. Only two of them dissented.

A bill to legalise same-sex unions is reported to have already been making its way through parliament. However, that process has been delayed mainly due to conservative groups who say they do not want Taiwan to be the first place in the continent to legalise such marriages.

Taiwan Gay Pride
Thousands of the same-sex activists marched in the streets in front of the Presidential Palace in Taipei last year calling the public to respect marriage equality SAM YEH/AFP/Getty Images