Taiwan on Friday legalised same-sex marriage in a landmark vote that made it the first Asian country to adopt such a legislation.

Lawmakers comfortably passed a bill allowing same-sex couples to form “exclusive permanent unions” along with another clause that would let them apply for a “marriage registration” with government agencies, AFP reported.

Thousands of gay rights supporters gathered outside parliament despite heavy rain waving rainbow flags, flashing victory signs and breaking into cheers as the news broke.

“On May 17th, 2019 in #Taiwan, #LoveWon,” President Tsai Ing-wen wrote on Twitter to celebrate the vote. “We took a big step towards true equality, and made Taiwan a better country.” She has spoken for same-sex marriage several times since she was elected in January 2016. However, conservative groups had opposed any changes to the law, staging massive protests against such a move.

Phil Robertson, deputy Asia director at Human Rights Watch, said, “Incredible victory for #LGBT rights, non-discrimination, respect, & families! Love wins again and again.”

Friday’s vote is a major victory for the island’s LGBT community, which has campaigned to get equal marriage rights as heterosexual couples. Other key sections of the law that are being debated and voted include the provisions for same-sex couples to adopt. Gay rights groups were positive and have said they were willing to accept compromises, as long as the new law recognised the concept of marriage. They said they were willing to fight legal battles over surrogacy and adoption down the line.

In May 2017, Taiwan became the first country in Asia to legalise same-sex marriage but the government was unable to implement its top court ruling in the face of conservative opposition. The court had given the government time till May 24, 2019, to implement its order or see marriage equality enacted automatically. In a referendum last year, 67% voters had opposed same-sex marriage. The government had said the referendum results would not impact the court’s ruling on same-sex marriage, but the results had made it tougher for lawmakers to pass legislation.