Taiwan has become the first place in Asia to legalise same-sex marriage, with thousands of demonstrators outside parliament cheering and waving rainbow flags despite national divisions over marriage equality.
Lawmakers from the majority Democratic Progressive Party (DPP) backed the bill, which passed 66 to 27, though the measure could complicate President Tsai Ing-wen's bid to win a second term in elections next year.
Despite heavy rain, some demonstrators outside parliament in Taipei embraced while others hailed the vote with chants of "Asia's first," and "Way to go, Taiwan!"
The bill, which offers same-sex couples similar legal protections for marriage as heterosexuals, will take effect after Tsai signs it into law.
"Today, we have a chance to make history and show the world that progressive values can take root in an East Asian society," Tsai wrote on Twitter pre-vote.
"Today, we can show the world that #LoveWins."
It was not immediately clear, however, if same-sex couples are entitled to key rights such as adoption and cross-national marriage, with parliament continuing to discuss the measure on Friday.
The vote followed a years-long tussle over marriage equality that culminated in a 2017 declaration by the democratic island's constitutional court giving same-sex couples the right to marry, and setting a May 24 deadline for legislation.
However, Friday's measure could prove a challenge to Tsai's bid for a second term in a January presidential election, after a poll defeat last year for her DPP was blamed partly on criticism of her reform agenda.
Late last year, Taiwan voters opposed same-sex marriage in a series of referendums, defining marriage as being between a man and a woman while seeking a special law for such unions.
"How can we ignore the result of the referendums, which demonstrated the will of the people?" John Wu, a legislator from the opposition Kuomintang party, asked parliament before Friday's vote.
Conservative groups that oppose same-sex marriage said the legislation disrespected the people's will.