Same-sex marriage supporters cheer outside the Legislative Yuan on Friday in Taipei, Taiwan. (AP photo/Chiang Ying-ying)

TAIPEI, Taiwan (AP) — Taiwan’s legislature voted Friday to legalize same-sex marriage, a first in Asia and a boost for LGBT rights activists who had championed the cause for two decades.

Lawmakers pressured by LGBT groups as well as church organizations opposed to the move approved most of a government-sponsored bill that recognizes same-sex marriages and gives couples many of the tax, insurance and child custody benefits available to male-female married couples.

That makes Taiwan the first place in Asia with a comprehensive law allowing and laying out the terms of same-sex marriage.

“It’s a breakthrough, I have to say so. I could not imagine that could happen in just a few years,” said Shiau Hong-chi, professor of gender studies and communications management at Shih-Hsin University in Taiwan.

“Taiwan’s action today should sound a clarion call, kicking off a larger movement across Asia to ensure equality for LGBT people and proactive protection of their rights by governments throughout the region,” Phil Robertson, deputy Asia director for Human Rights Watch, wrote on Twitter. “No more excuses!”

Thousands of people, including same-sex couples, demonstrated Friday morning in the rainy streets outside parliament before the vote. Many carried rainbow-colored placards stating, “The vote cannot fail.” About 50 opponents sat under a tent outside parliament and gave speeches favoring marriage only between men and women.

Taiwan’s Constitutional Court in May 2017 said the constitution allows same-sex marriages and gave parliament two years to adjust laws accordingly.

The court order mobilized LGBT advocacy groups pushing for fair treatment, as well as opponents among church groups and advocates of traditional Chinese family values that stress the importance of marriage and producing offspring.

Religion, conservative values and political systems that discourage LGBT activism have stopped momentum toward same-sex marriage in many Asian countries, from Japan through much of Southeast Asia, although Thailand is exploring legalization of same-sex civil partnerships.

Taiwan’s acceptance of gay and lesbian relationships began in the 1990s, when leaders in today’s ruling Democratic Progressive Party championed the cause to help Taiwan stand out in Asia as an open society.

Although claimed by China as its own territory, Taiwan is a self-governing democracy with a vibrant civil society dedicated to promoting rights for sexual and ethnic minorities, women, the handicapped and others.

Ruled by the authoritarian Communist Party, mainland China remains much more conservative and officials have repeatedly discouraged even discussion of legalizing same-sex marriage.

Opponents in Taiwan raised fears of incest, insurance scams and children confused by having two mothers or two fathers. Both sides of the issue have held colorful street demonstrations and lobbied lawmakers.

In November 2018, a majority of Taiwan voters rejected same-sex marriage in an advisory referendum. However, legislators favoring the bill, and voting separately on each item largely along party lines, said it followed the law as well as the spirit of the referendum.