Taiwan's parliament legalised same-sex marriage on Friday in a landmark first for Asia as the government survived a last-minute attempt by conservatives to pass watered-down legislation.
Lawmakers comfortably passed a bill allowing same-sex couples to form "exclusive permanent unions" and another clause that would let them apply for a "marriage registration" with government agencies.
The vote -- which took place on the International Day Against Homophobia, Transphobia and Biphobia -- is a major victory for the island's LGBT community and it places the island at the vanguard of Asia's burgeoning gay rights movement.
Thousands of gay rights supporters gathered outside parliament despite heavy downpours, waving rainbow flags, flashing victory signs and breaking into cheers as the news filtered out.
In recent months conservatives had mobilised to rid the law of any reference to marriage, instead putting forward rival bills that offered something closer to limited same-sex unions. But those bills struggled to receive enough votes.
Gay rights groups hailed the vote on Friday, saying the ability to apply for a "marriage registration" -- known as Clause Four -- put their community much closer to parity with heterosexual couples.
"The passage of Clause Four ensures that two persons of the same-sex can register their marriage on May 24th and ensure that Taiwan becomes the first country in Asia to legalise same-sex marriage and to successfully open a new page in history," said the Taiwan Alliance to Promote Civil Partnership Rights.
- Court order -
Two years ago Taiwan's top court ruled that not allowing same-sex couples to marry violates the constitution with judges giving the government until May 24 to make the changes or see marriage equality enacted automatically.
The law does not bring full equality with heterosexual couples -- it only allows for biological adoption, for example, and marriages with foreigners are not recognised.
But gay rights groups have said they were willing to accept compromises, as long as the new law recognised the concept of marriage, adding they could fight further legal battles over surrogacy and adoption down the line.
"For me the outcome today is not 100 percent perfect, but it's still pretty good for the gay community as it provides legal definition," Elias Tseng, a gay pastor who was among the crowds outside parliament, told AFP.
Victoria Hsu, a gay rights lawyer, said it was crucial that conservatives failed in their bid to delete the reference to marriage registration with lawmakers voting 66-27 in favour of the provision.
"In Taiwan a marriage will take effect when it's registered, so allowing marriage registration is no doubt recognising the marriage itself," she told AFP.
The first marriages are expected to be registered next Friday, the date the court set for their deadline.
- Families divided -
In the last decade, Taiwan has been one of the most progressive societies in Asia when it comes to gay rights, staging the continent's biggest annual gay pride parade.
But the island remains a staunchly conservative place, especially outside urban areas.
Conservative and religious groups were buoyed by a series of referendum wins in November, in which voters comprehensively rejected defining marriage as anything other than a union between a man and a woman, illustrating the limited popular support for change.
President Tsai Ing-wen hailed the vote as a "big step towards true equality" that "made Taiwan a better country."
Tsai had previously spoken in favour of gay marriage but was later accused of dragging her feet after the court judgement, fearful of a voter backlash.
Taiwan goes to the polls in January and the gay marriage issue could hamper Tsai's chances of re-election.
Opponents were incensed by the vote, saying the inclusion of the "marriage registration" clause ignored the 70 percent of voters who had cast ballots in the referendum wanting to keep marriage limited to a man and a woman.
Tseng Hsien-ying, from the Coalition for the Happiness of Our Next Generation, told local media the vote "trampled on Taiwanese people's expectations that a marriage and a family is formed by a man and a woman, a husband and a wife".
Australia and New Zealand are the only places in the wider Asia-Pacific region to have passed gay marriage laws.
Taiwan is the first place in Asia to do so.
Vietnam decriminalised gay marriage celebrations in 2015, but it stopped short of full legal recognition for same-sex unions.
"We hope this landmark vote will generate waves across Asia and offer a much-needed boost in the struggle for equality for LGBTI people in the region," Annie Huang, from Amnesty International Taiwan, said in a statement.