Lawmakers in Thailand voted on Tuesday to approve a marriage equality bill, a move that puts the country on a clear path to becoming the first in Southeast Asia to legalize same-sex marriage.

Thailand’s Senate passed the bill by 130 votes to 4, with some abstentions, on Tuesday afternoon. It was approved by the House of Representatives in March. The legislation would become law after it is reviewed by a Senate committee and the Constitutional Court and receives royal assent from the king, a formality that is widely expected to be granted.

“After 20 years of trying to legalize this matter,” the activist Plaifa Kyoka Shodladd, 18, said in the Senate chamber after the vote, “finally, love wins.”

The bill’s passage underscores Thailand’s status as a relative haven for gay couples in Asia. Only Taiwan and Nepal have legalized same-sex marriage.

While India came close to doing so last year, the Supreme Court deferred the decision to Parliament. Prime Minister Narendra Modi has spoken strongly against legalizing gay marriage.

In some Asian countries, gay sex is a criminal offense. Indonesia, where gay marriage is illegal, made extramarital sex illegal in 2022. In 2019, Brunei made gay sex punishable with death by stoning. It later said it would not carry out executions, after widespread international protest.

After the bill’s passage, supporters celebrated the milestone with flags and colorful balloons as a Pride rally featuring a drag show got underway in downtown Bangkok. Prime Minister Srettha Thavisin said he would host a celebration for activists on Tuesday evening, though he said he could not attend the event because of a Covid infection.

Supporters like Mookdapa Yangyuenpradorn, an activist with the Southeast Asia-based human rights group Fortify Rights, also called on the authorities to act swiftly in enforcing the legislation once it goes into effect 120 days after it is endorsed by the king.

Critics like Gen. Worapong Sanga-Nate, a senator, said that legalizing same-sex marriage would undermine the institution of the family and cause logistical challenges in the Ministry of Interior.

Thailand’s bill, which amends the country’s Civil and Commercial Code, calls marriage a partnership between two people age 18 and above, without specifying their gender. It also gives L.G.B.T.Q. couples equal rights to adopt children, claim tax allowances, inherit property and give consent for medical treatment when their partners are incapacitated.

The bill has been contentious since its first version was introduced over 20 years ago. While Thailand is one of the most open places in the world for gay couples, it is socially conservative in other ways. In February, lawmakers dismissed a proposal to let people change genders on official documents.

But a majority of the Thai public supports the marriage equality bill. Last year, 60 percent of adults in Thailand said they supported legalizing same-sex marriage in a survey by the Pew Research Center.

Ryn Jirenuwat contributed reporting.