(Bloomberg) -- Chile’s congress gave its final approval to a bill allowing same-sex marriage in a landmark vote before a polarized presidential runoff that pits two candidates with clashing views on gay rights.

The Senate and Lower House approved the measure on Tuesday, clearing the way for it to become law. Current President Sebastian Pinera had fast-tracked the legislation despite opposition from some groups within his center-right coalition.

Chileans are reassessing norms that have dominated its conservative, Catholic society for decades. This week, the lower house rejected a proposal to expand abortion rights. On Dec. 19, voters will cast their ballots in a presidential runoff between Gabriel Boric, who is a vocal advocate of gay rights, and Jose Antonio Kast, who backs marriage between a man and a woman.

Until now, Chile has only allowed civil unions between gay couples which provide some legal benefits. It now joins regional peers such as Costa Rica, Brazil and Argentina in fully legalizing same-sex marriage.

Read more: LGBTQ Rights Regress in Unexpected Places Yet Advance in Others

Pinera surprised allies by announcing earlier this year that he would back the legislation that had been stuck in congress since 2017. Within the governing coalition, most legislators of the right-wing Independent Democratic Union party disapproved of the decision, opening another rift with the head of state. 

Human rights are also being weighed by the Constitutional Assembly as it works on a new charter, which will be put to a referendum next year. Chile is rewriting its constitution after a period of unrest that flared in late 2019.

©2021 Bloomberg L.P.