Cuba has legalized same-sex marriage after Cubans approved a family code that strengthened rights for the island's minority, the country's National Electoral Council declared on Monday.

The new Cuban family code protects women, children, and the elderly, and it allows LGBTQ couples to marry and adopt children.

According to the Electoral Council, 74.1% of those eligible to vote in Sunday's nationwide referendum turned out to vote.

As of 9 a.m. ET on Monday morning, 94% of the ballots had been counted, with 3,936,790 voting in favor and 1,950,090 voting against, indicating overwhelming support for the new law.

On the communist-run island for many years, LGBTQ people in Cuba experienced official discrimination. After Fidel Castro came to power in the early 1960s, many LGBT people were detained in government work camps alongside political dissidents. Though homosexuality was legalized in Cuba in 1979, many gay men and women reported they still suffered open prejudice.

Official attitudes towards homosexuality on the Communist-run island have improved over the past decades, largely because of the efforts of former leader Raúl Castro's daughter Mariela.

The country's president, Miguel Diáz-Canel, said in a speech as he cast his ballot on Sunday that he anticipated the majority of people would do so and that the new code recognized the diversity of individuals, families, and ideas.

However, religious organizations and conservatives were vocal in their opposition to the changes.

Cuban lawmakers abandoned provisions that would have legalized same-sex marriage in 2018 due to concerns that a homophobic response would reduce turnout for a vote to ratify a new constitution. The next year, Cuban police broke up a peaceful LGBTQ rights procession, claiming that the marchers lacked the necessary permits.

The rising evangelical minority in Cuba, in particular, has openly campaigned against the family code's approval.

Some opposition groups also promoted a "no" vote, asking Cubans to take advantage of a rare chance to deny the communist-run government of the island nation electoral success.

Following a violent crackdown on all forms of dissent in recent years, some anti-government activists believe the referendum is an attempt by the state to repair its human rights reputation.

The vote also takes place in the midst of a severe energy crisis that has caused regular power outages that affect millions of people on the island.

The Cuban government, however, made a full court push in support of the new family code across state-run media in the weeks leading up to the referendum, arguing that the new code is evidence the island's now more than six-decade-old revolution is capable of adjusting to the times.