SANTA FE — New Mexico became the latest state to legalize gay marriage Thursday as its highest court declared it is unconstitutional to deny marriage licenses to gay and lesbian couples.
Justice Edward L. Chavez said in a ruling that none of New Mexico’s marriage statutes specifically prohibits same-sex marriages, but the state’s laws as a whole have prevented gay and lesbian couples from marrying.
Same-sex couples have been subjected to a history of discrimination and violence, the justices said. Barring them from getting married violates the state constitution’s equal protection clause.
‘‘We hold that the State of New Mexico is constitutionally required to allow same-gender couples to marry and must extend to them the rights, protections and responsibilities that derive from civil marriage under New Mexico law,’’ Chavez wrote.
The high court rejected opponents’ argument that defining marriage as being between a man and a woman relates to the ‘‘important, overriding governmental interests’’ of having and raising children.
‘‘Procreation has never been a condition of marriage under New Mexico law, as evidenced by the fact that the aged, the infertile, and those who choose not to have children are not precluded from marrying,’’ Chavez wrote.
Under the ruling, clergy who disagree with same-sex marriage can decline to perform wedding ceremonies for gay and lesbian couples.
New Mexico joins 16 other states and the District of Columbia in allowing gay marriage either through legislation, court rulings or voter referendums.
Eight of the state’s 33 counties started issuing marriage licenses to same-sex couples in August when a county clerk in southern New Mexico independently decided to allow the unions.
County officials had asked the high court to clarify the law and establish a uniform state policy on gay marriage.
Historically, county clerks have denied marriage licenses to same-sex couples because state statutes include a marriage license application with sections for male and female applicants.
Thursday’s ruling was a victory for gay rights activists who had been unable to win a legislative resolution of the issue.
‘‘This truly is a historic and joyful day for New Mexico,’’ said Laura Schauer Ives, legal director of ACLU-New Mexico. ‘‘The more than 1,000 same-sex couples who have already married in New Mexico can now rest certain knowing their marriages will be recognized and respected by our state.’’
Miriam Rand, 64, and Ona Porter, 67, both of Albuquerque and plaintiffs in the case, said they were ecstatic when they heard about the decision.
‘‘We had a strong sense that the court was going to come down on this side of the opinion,’’ Rand said. ‘‘Many years of work have gone into making this day possible.’’
The American Civil Liberties Union and the National Center for Lesbian Rights represented same-sex couples in the Supreme Court case.
They contended that gay marriage must be allowed because of constitutional guarantees of equal protection under the law and the state constitutional prohibition against discrimination based on sexual orientation.
Attorney General Gary King also said he was pleased with the high court’s decision.
Asked whether same-sex couples could feel confident in getting a marriage license in New Mexico, he said yes.
King acknowledged that the laws in New Mexico that led to the debate are very complex and that state lawmakers will probably want to weigh in during their next session.