New Mexico’s Supreme Court on Thursday moved to legalize gay marriage in the state, capping a year that had already seen historic gains for marriage equality.

“Prohibiting same-gender marriages is not substantially related to the governmental interests advanced by the parties opposing same-gender marriage or to the purposes we have identified,” wrote Justice Edward L. Chávez in his opinion. “Therefore, barring individuals from marrying and depriving them of the rights, protections, and responsibilities of civil marriage solely because of their sexual orientation violates the Equal Protection Clause under Article II, Section 18 of the New Mexico Constitution.”

Six same-sex couples in New Mexico filed a lawsuit in March seeking the freedom to marry. In terms of marriage laws, New Mexico was unique in that it was the only state in the country that neither permitted gay couples to marry nor explicitly prohibited them from doing so. The state constitution had no legislation on the books either way.

Because of this ambiguity, Dona Ana County clerk Lynn Ellins began issuing marriage licenses to same-sex couples last August. Ellins had long been a gay-rights advocate, and wanted to speed up the process once he caught wind of the lawsuit. Other clerks soon followed, either at the direction of a district judge, or of their own volition. As of October, when the state Supreme Court heard oral arguments in the case, more than 900 same-sex couples had been married in New Mexico. The aforementioned plaintiffs wanted to make it so that every county clerk had to issue a marriage license to any two adults seeking one, regardless of sexual orientation.

Opponents argued that even though New Mexico did not expressly ban same-sex marriage it did have state statutes that contained a marriage license application using the terms “husband” and “wife.” The state Supreme Court bought that argument, stating that when taken as a whole, “the statutes have the effect of precluding same-gender couples from marrying and benefiting from the rights, protections, and responsibilities that flow from a civil marriage.” But the court also concluded those laws amounted to unconstitutional discrimination.

Eight states, including New Mexico, have struck down barriers to same-sex nuptials this year, and the U.S. Supreme Court in June cleared the way for the federal government to begin honoring gay marriages in the 17 states that currently allow them.

“The past few years have seen an amazing show of support for the freedom to marry for all loving and committed couples,” said Elizabeth Gill – a staff attorney with the ACLU Lesbian Gay Bisexual and Transgender Project, one of the groups representing the plaintiffs – in a statement. “Today’s victory in New Mexico brings us one step closer to the day when marriage equality is a reality nationwide.”