(CNN) -- Lawmakers in Taiwan have approved a bill legalizing same-sex marriage, a landmark decision that makes the self-ruled island the first place in Asia to pass gay marriage legislation.
The vote came almost two years after the island's Constitutional Court ruled that the existing law -- which said marriage was between a man and a woman -- was unconstitutional. The panel of judges gave the island's parliament two years to amend or enact new laws.
On Friday -- only a week off the two-year deadline -- lawmakers in Taiwan's Legislative Yuan passed a bill making same-sex marriage a reality. It will go into effect on May 24.
Tens of thousands of people braved pouring rain Friday to demonstrate in favor of same-sex marriage outside the parliament, where lawmakers were voting on three draft bills, one tabled by the country's Cabinet -- which would ultimately prove successful -- and two watered-down rival bills tabled by conservative groups.
The successful Cabinet bill was backed by LGBTQ groups, despite the fact it creates a law different to straight marriage. For instance, under Cabinet's bill, a Taiwanese person could not marry foreigners from countries where same-sex marriage is not legal.
Thousands turned of gay rights activists, many bearing umbrellas, rainbow flags and rainbow placards, gathered in heavy rain in the capital Taipei in support of marriage equality.
Ahead of the vote, Taiwan's President Tsai Ing-wen tweeted: "Today we have a chance to make history and show the world that progressive values can take root in an East Asian society."
Although the island has a large gay community and its annual gay pride parade is the biggest in Asia, the issue of marriage equality has divided Taiwanese society. In a controversial referendum in November last year, 67% voted to reject same-sex marriage.
In recent months conservative groups have campaigned against same-sex marriage reform, pushing for a law that would see gay marriage legislation redefined as same-sex unions.
LGBTQ rights in Asia
Taiwan's vote sets it apart from other parts of Asia where LGBTQ rights have regressed.
In mainland China, where homosexuality is legal but prejudices and discrimination against LGBT people persist under Communist Party rule, an author of same-sex erotic fiction was sent to jail for 10 years in November.
In April, the ruler of the tiny, oil-rich kingdom of Brunei announced he would introduce death by stoning for those convicted of gay sex. Sultan Hassanal Bolkiah has since said the death penalty will not be imposed, although he did not repeal the law.
In Indonesia, declining secularism has led to deepening discrimination against the country's gay, lesbian and transgender communities. Last year, two men accused of being gay received 87 lashes for gay sex in the country's conservative Aceh province.
More than two dozen countries around the world allow gay marriage, according to Pew Research.
™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.