(CNN) -- Mexico's Supreme Court on Thursday upheld a Mexico City law that legalized same-sex marriage. In an 8-2 vote, the high court found the law, which went into effect in March, constitutional.

The ruling comes a day after a court in the United States found a law banning gay marriage unconstitutional.

The justices upheld the law in Mexico City, but did not decide whether their decision affects jurisdictions in the rest of the country. The court will take up the issue again next week, the state-run Notimex news agency reported.

Mexico City's law also allows same-sex couples to adopt children. The constitutionality of that part of the law will be decided next week.

The lawsuit against the gay marriage law was presented by the federal attorney general's office, which challenged the legality of the measure.