Now that Mexico's top court has given the green light to gay marriage, a host of states should bring their laws into line, a Supreme Court justice said.

The court ruled in a decision published on June 19 that laws restricting marriage to a man and a woman were unconstitutional.

The decision, based on five separate rulings, means gay couples may marry by court injunction in states which have not legalized same-sex unions. Until state legislatures change their statutes, however, the couples must still petition courts case by case.

For states to persist in this makes little sense, Supreme Court Judge Olga Sanchez said in an interview on Tuesday.

"What's the point in having invalid norms? You should just change your legislation," Sanchez said.

In all but two of Mexico's 31 states, gay marriage is still banned under local laws.

Mexico City, which is not a state, became the first capital in Latin America to allow same-sex unions in 2009. Only the states of Coahuila and Quintana Roo have followed suit.

Sanchez, a liberal voice in the court, acknowledged that a stand-off between the courts and some state congresses could last years. But she said judges would keep giving injunctions to same-sex couples.

The near-unanimous decision by Mexico's top court was criticized by conservative groups and religious figures.

Mexico has the world's second-largest Roman Catholic population and a survey by polling firm Parametria showed 48 percent of respondents were against same-sex unions, with 43 percent in favor.

"Part of the population is for, part is against, but we don't see people by their sexual orientation - we see people," Sanchez said. "They are human beings with rights and we are analyzing how to protect their rights."

Until states legalize same-sex marriage, gay couples still face extra hurdles, such as having to pay for a lawyer to file an injunction, Sanchez said.

The border region of Chihuahua could be the next state to change the law, and expects to vote on a bill in the autumn.

"If we now legislated in a way that chose not to permit same-sex marriage in Chihuahua, we would be going against a national law and it would be a problem," said Cesar Augusto Pacheco, president of the state's congress.