In a long-sought victory for the gay rights movement in Taiwan, the island's constitutional court on Wednesday ruled that same-sex marriage is a right guaranteed by the Constitution.

The ruling by the Council of Grand Justices in favor of legalizing same-sex marriage makes Taiwan the first Asian jurisdiction to allow such unions.

The court ruled that the Civil Code, which stipulates that marriage is the legal union between a man and a woman, is unconstitutional.

According to the ruling, authorities concerned must amend or enact relevant laws in accordance with the ruling of the court's interpretation within two years.

In December last year, the legislature's Judiciary and Organic Laws and Statutes Committee completed the preliminary review of six different versions of amendments to the Civil Code that would legalize same-sex marriage.

Under the integrated proposal, marriage would be the legal union of a man and a woman or between two persons, and the legal age for both sexes for marriage would be 18. Currently a woman must be at least 16 and a man at least 18 to be able to marry.

The proposal opposes any discrimination based on gender, sexual preference or sexual orientation in matters of adoption. Same-sex couples would also have the same rights and obligations enjoyed by husband and wife, such as child custody and visitation.

However, due to the controversial nature of the issue, the bill has been bogged down in the legislature since then, leading some to criticize President Tsai Ing-wen for being pessimistic in honoring her campaign promise. Tsai has made it clear that she supports marriage equality.

While Tsai's ruling Democratic Progressive Party and the main opposition Nationalist Party both said they support marriage equality, they have been in a deadlock on the way to legalize it.

The constitutional court ruling says it is within the discretion of the authorities concerned to determine the formality for achieving the equal protection of the freedom of marriage.

The ruling drew mixed responses from the public.

 Taiwan constitutional court rules in favor of same-sex marriage

Jien Ing, who led a group of anti-same-sex marriage protesters outside the constitutional court in downtown Taipei, expressed regret after learning of the ruling.

"It's tantamount to saying that wrong is right," he said. "It also encourages people to try something that they don't need to try."

Jien said his group had two demands -- to annul the interpretation and to hold a referendum on the constitutionality of same-sex marriage.

Another protester wearing a T-shirt bearing the slogan "Taiwan does not welcome same-sex marriage" said the ruling was not welcomed in Taiwan.

Several kilometers away from the Legislative Yuan, groups in favor of same-sex marriage held a rally celebrating the long-sought victory.

A supporter of same-sex marriage, who preferred to be identified only by his surname Su, said he welcomed the ruling, adding that it marked a new beginning for lesbian, gay, bisexual and transgender people.

Su, who came to the rally with his male friend, said he hopes people like him will not experience the same discrimination as he did when he was growing up.

Su, a 27-year-old professional baker, said he wants to get married in the future, but he will not rush it, at least not in the next two years.