BOSTON – A battle over a federal law that defines marriage as a union between a man and a woman appears headed for the Supreme Court after an appeals court ruled Thursday that denying benefits to married gay couples is unconstitutional.

In a unanimous decision, the three-judge panel of the 1st U.S. Circuit Court of Appeals in Boston said the 1996 law deprives gay couples of the rights and privileges granted to heterosexual couples.

The court didn’t rule on the law’s more politically combustible provision: that states without same-sex marriage cannot be forced to recognize gay unions performed in states where it’s legal. It also wasn’t asked to address whether gay couples have a constitutional right to marry.

The law was passed at a time when it appeared Hawaii would legalize gay marriage. Since then, many states have instituted their own bans on gay marriage, while eight states have approved the practice, led by Massachusetts in 2004.

The court, the first federal appeals panel to rule against the benefits section of the law, agreed with a lower court judge who in 2010 concluded that the law interferes with the right of a state to define marriage and denies married gay couples federal benefits given to heterosexual married couples, including the ability to file joint tax returns. The ruling came in two lawsuits, one filed by the Boston-based legal group Gay & Lesbian Advocates & Defenders and the other by state Attorney General Martha Coakley.

“For me, it’s more just about having equality and not having a system of first- and second-class marriages,” said plaintiff Jonathan Knight, a financial associate at Harvard Medical School who married Marlin Nabors in 2006.

“I think we can do better, as a country, than that,” said Knight, a plaintiff in the GLAD lawsuit.

Knight said the Defense of Marriage Act costs the couple an extra $1,000 a year because they cannot file a joint federal tax return.

Opponents of gay marriage blasted the decision.

“This ruling that a state can mandate to the federal government the definition of marriage for the sake of receiving federal benefits, we find really bizarre, rather arrogant, if I may say so,” said Kris Mineau of the Massachusetts Family Institute.

Since Congress passed the law, eight states have approved gay marriage, including Massachusetts, Connecticut, New York, Iowa, New Hampshire, Vermont, Maryland, Washington state and the District of Columbia. Maryland and Washington’s laws are not yet in effect and may be subject to referendums.

Last year, President Obama announced that the Department of Justice would no longer defend the constitutionality of the law. After that, House Speaker John Boehner convened the Bipartisan Legal Advisory Group to defend it. The legal group argued the case before the appeals court.

White House spokesman Jay Carney said the appeals court ruling is “in concert with the president’s views.” Obama, who once opposed gay marriage, declared his unequivocal personal support on May 9.

Carl Tobias, a constitutional law professor at the University of Richmond, said the appeals court kept its ruling narrow, declaring unconstitutional only the section of the law on federal benefits. Although supporters and opponents of gay marriage may depict the ruling as the beginning of the end of the law, he said, the Supreme Court is likely to limit its ruling to the benefits issue as well.

Several times in its ruling, the appeals court noted that the case will probably end up before the Supreme Court.

“I think lawyers could argue that the arguments are equally applicable to the other sections of the law, but you have to stretch. You have to take those out of the context in which it’s being applied, and I don’t think the court will do that,” Tobias said.