mexico city gay pride
Mexico’s Supreme Court ruled Tuesday that a 2013 law in the southeastern state of Campeche that forbids same-sex couples from adopting children is unconstitutional. In this photo, participants march during a Gay Pride Parade in Mexico City on June 27, 2015. Reuters/Edgard Garrido

Mexico’s Supreme Court ruled Tuesday that a 2013 law in the southeastern state of Campeche that forbids same-sex couples from adopting children is unconstitutional and struck it down.

The challenge to the ban was filed by the state’s human rights commission. Supreme Court Judge Margarita Luna announced her intention to present the motion on a federal level in early July. Gay marriages and adoption laws are largely legal in the country’s heartland, though several far-flung states witness more opposition.

The state law was struck down in a 9-1 ruling. Presiding Judge Luis Maria Aguila said the decision was made keeping in mind the protection of adopted children. "I see no problem for a child to be adopted in a society of co-existence, which has precisely this purpose. Are we going to prefer to have children in the street, which according to statistics exceed 100,000? We attend, of course, and perhaps with the same intensity or more, to the interests of the child," Aguila said, according to Latin American news network TeleSUR.

In June, the apex court also ruled that it was unconstitutional to deny marriage to people of the same sex -- a ruling that came shortly before a similar one from the U.S. Supreme Court. The Mexican court ruling does not legalize same-sex marriage nationwide, but opens the door to couples seeking marital recognition to pursue injunctions against states.

In Mexico, gay marriages were first legalized in the capital Mexico City in 2009, in a ruling that was upheld by the country’s highest court. Same-sex couples who married under the city’s law have been adopting children since 2010. In addition, same-sex marriage rights are fully recognized in the states of Chihuahua, Coahuila, Guerrero and Quintana Roo.

However, the issue has been contentious in the largely Catholic country, which has faced religious opposition to same-sex marriages and adoption. A 2013 survey found that 52 percent of Mexicans supported same-sex marriage rights, but only 24 percent backed the adoption of children by such couples. The Roman Catholic Church opposes same-sex marriage and adoption, but it has said that it will not refuse to baptize any children.