* Demonstrators cheer and wave rainbow flags to welcome vote
* Bill passes parliament 66 to 27, to become law May 24
* Could complicate president's bid to win second term
* Rights group Amnesty welcomes end of long, arduous campaign (Adds details, quotes; paragraphs 5-7;10-12)
By Yimou Lee
TAIPEI, May 17 (Reuters) - Taiwan became the first place in Asia to legalise same-sex marriage on Friday, as thousands of demonstrators outside parliament cheered and waved rainbow flags, despite deep divisions over marriage equality.
Lawmakers of the majority Democratic Progressive Party (DPP) backed the bill, which passed 66 to 27, although the measure could complicate President Tsai Ing-wen's bid to win a second term in presidential elections next year.
Demonstrators braved heavy rain outside parliament in Taipei, the capital, with some embracing tearfully as 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, takes effect on May 24 after Tsai signs it into law.
"Today is a proud day for Taiwan. We demonstrate the value of kindness and inclusiveness from this land to the world," Tsai told reporters after the measure passed.
"Through legalisation, (we) ensure that everyone's love is equal and everyone is treated equally," added Tsai, who campaigned on a promise of marriage equality in the 2016 presidential election.
The law, however, allows same-sex marriages only between Taiwanese, or with foreigners whose countries recognise same-sex marriage. It permits adoption of children biologically related to at least one of the same-sex pair.
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 deadline of May 24 for legislation.
Taipei's colourful gay pride parade, one of Asia's largest, puts on display every year the vibrancy of the island's lesbian, gay, bisexual and transgender (LGBT) community.
"After 30 years of fighting, homosexuals can finally get married," said 32-year-old musician Ken Chen, who was outside parliament watching the vote broadcast live. "Many of us were in tears."
CHALLENGE FOR TSAI
Rights group Amnesty International welcomed the end of a "long and arduous campaign".
"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," said Annie Huang, acting director of Amnesty International Taiwan.
However, Friday's measure could prove a hurdle for Tsai's effort to seek a second term in a January election, after a DPP poll defeat last year was blamed partly on criticism of her reform agenda, including marriage equality.
Late last year, Taiwan voters opposed same-sex marriage in a series of referendums, defining marriage as being between a man and a woman in civil law, though seeking a special law for same-sex unions.
Conservative groups that oppose same-sex marriage said the legislation disrespected the people's will.
"The will of some seven million people in the referendum has been trampled," one group, the Coalition for the Happiness of Our Next Generation said in a statement. "The massive public will strike back in 2020."
Australia passed laws allowing same-sex marriage in 2017, but such unions are not recognised by Hong Kong and neighbouring China, which regards Taiwan as a wayward province to be returned to the fold by force, if necessary.
(Reporting by Yimou Lee, I-Hwa Cheng and Taipei newsroom; Editing by Clarence Fernandez and James Pomfret)
Openly is an initiative of the Thomson Reuters Foundation dedicated to impartial coverage of LGBT+ issues from around the world.
Our Standards: The Thomson Reuters Trust Principles.