Cubans voted to legalize same-sex marriage and adoption and surrogacy in a referendum over the weekend, the communist country’s election officials said on Monday.

Preliminary results point to an “irreversible trend,” with 66 percent of the votes counted so far in favor of the government-backed change, Electoral Council President Alina Balseiro said on state television.

“The Family Code has been ratified by the people,” she said.

The updated code represents a major shift in a country where machismo runs high and where authorities sent LGBTQ people to militarized labor camps in the 1960s and 1970s.

Since then, official attitudes have changed, and the government has conducted an intense media campaign in favor of the revision that will replace the country’s 1975 Family Code.

The new law allows surrogate pregnancies as long as no money changes hands, while strengthening the rights of children, the elderly and the disabled.

It defines marriage as the union between two people and not that of a man and a woman.

According to the National Electoral Council, as of 5:00 p.m. (2100 GMT) Sunday evening, about 68 percent of Cuba’s 8.4 million eligible voters had cast their ballots.

A majority of 50 percent of voters was required for the law to pass.

The referendum came amid the country’s worst economic crisis in 30 years, and some predicted the vote could present an opportunity to voice opposition to the government, with dissidents urging citizens to reject the code or abstain from voting.