In a first for Asia, Taiwan’s Constitutional Court ruled in favor of same-sex marriage on Wednesday, punctuating a yearslong campaign by advocates for gay rights in one of the continent’s most liberal democracies.

In its majority opinion, the court said a provision in the current civil code barring same-sex marriages violated two articles of the constitution safeguarding human dignity and equality under the law.

Authorities must now either enact or amend relevant laws within two years, failing which same-sex couples could have their marriages recognized by submitting a written document, the court said.

The ruling was greeted with rapturous applause outside the legislature not far from the court in the center of the capital, Taipei, where hundreds had gathered with rainbow flags and noisemakers emblazoned with slogans in favor of gay marriage.

A bill to enforce the ruling is already working its way through the legislature, where both the ruling and major opposition parties support legalization of same-sex marriage. Surveys show a majority of the public is also in favor, as is President Tsai Ing-wen, Taiwan’s first female leader.

Gays and lesbians in Taiwan have formed an effective lobby in recent years, with an annual Gay Pride march drawing tens of thousands. While some conservative religious and social groups have mobilized against same-sex marriage, their influence is much less potent than in the United States and many other parts of the world.

“The need, capability, willingness and longing, in both physical and psychological senses, for creating such permanent unions of intimate and exclusive nature are equally essential to homosexuals and heterosexuals, given the importance of the freedom of marriage to the sound development of personality and safeguarding of human dignity,” the court said in its ruling.

Two of the court’s 15 justices filed dissenting opinions and one recused himself in the case.

Despite the spread of same-sex marriage in a few regions since 2001, gay and lesbian couples had been allowed to marry in only 22 of the world’s nearly 200 countries. In Asia, Taiwan is the first government to legalize such unions, while South Africa is the only country in Africa to allow them. More than 70 countries continue to criminalize homosexual activity.

Globally, the pace of civil rights victories has slowed against the background of a steady stream of reports of anti-gay violence and persecution.

Recent weeks have witnessed large-scale detentions of gay men in Nigeria and Bangladesh, and accounts of roundups and torture of scores of gays in Chechnya. In Indonesia, a major police raid on a gay sauna was followed two days later by the public caning of two gay men.

  • I was very happy to discover this page. I wanted to thank you for ones time
    just for this wonderful read!! I definitely liked every part of it and i also have you book-marked to look
    at new things in your site.

  • You’ve made some good points there. I looked on the internet
    for more information about the issue and found most people will go
    along with your views on this web site.