Lawmakers in the border state of Tamaulipas voted Wednesday night to legalize same-sex marriages, becoming the last of Mexico's 32 states to authorize such unions.

The measure to amend the state’s Civil Code passed with 23 votes in favor, 12 against and two abstentions, setting off cheers of "Yes, we can!" from supporters of the change.

The session took place as groups both for and against the measure chanted and shouted from the balcony, and legislators eventually moved to another room to finish their debate and vote.

HURRICANE ROSLYN MAKES LANDFALL IN MEXICO, BRINGS ‘LIFE-THREATENING’ STORM SURGE

The president of the Supreme Court of Justice of the Nation, Arturo Zaldívar, welcomed the vote. "The whole country shines with a huge rainbow. Live the dignity and rights of all people. Love is love," he said on Twitter.

Gay pride flag

A person holds a rainbow flag during a gay pride parade. Mexico has legalized same-sex marriage in all of the country's 32 states. (REUTERS/Axel Schmidt)

A day earlier, lawmakers in the southern state of Guerrero approved similar legislation allowing same-sex marriages.

CLICK HERE TO GET THE FOX NEWS APP

In 2015, the Supreme Court declared state laws preventing same-sex marriage unconstitutional, but some states took several years to adopt laws conforming with the ruling.