Mexico’s Supreme Court has upheld a gay marriage law in the country’s capital, Mexico City.

The city passed the law seven months ago and more than 300 gay couples have since tied the knot.

Federal prosecutors urged the court to strike down the law, claiming it violated constitutional provisions to protect the family.

However, eight of the ten Supreme Court judges disagreed, AP reports. Some argued that gay couples should have equal rights under the constitution, while others said it was down to local legislatures to rule on the issue.

It is not clear whether the court’s decision could affect marriage laws in the rest of the country.

When passed, the law gave gay couples the right to adopt and the right to have their marriages recognised elsewhere in Mexico. The Supreme Court has yet to rule on these issues but is expected to discuss the adoption clause on Monday.

Mexico’s Catholic church and President Felipe Calderon’s conservative government both opposed the law.

Last month, Argentina became the first country in Latin America to allow same-sex marriage.

Previously, only a few areas in Argentina recognised civil unions between same-sex couples: Buenos Aires itself, the province of Río Negro in Patagonia, and the city of Villa Carlos Paz in Córdoba province.