Image caption The Boston court is the first to rule against the benefits clause of the Defense of Marriage Act

A US appeals court has ruled key parts of a federal law denying benefits to same-sex couples are unconstitutional.

A three-judge panel in Boston, Massachusetts, unanimously said the 1996 Defense of Marriage Act (Doma) discriminated against gay couples.

Under the act, legally married gay couples are denied benefits, including the ability to file joint tax returns.

The US Supreme Court must now decide the matter, since only it can rule if Congress' laws are constitutional.

The court did not rule on whether same-sex couples have a constitutional right to marry.

The 1st Circuit appeals court agreed with a lower court's ruling that the federal law interfered with the states' right to define marriage.

Thursday's decision applies only to states within the circuit: Massachusetts, Rhode Island, Maine and New Hampshire and Puerto Rico.

It is the first federal appeals court to find the section of the law relating to federal tax, health and pension benefits unconstitutional.

"One virtue of federalism is that it permits this diversity of governance based on local choice, but this applies as well to the states that have chosen to legalize same-sex marriage," Judge Michael Boudin wrote .

"Under current Supreme Court authority, Congress' denial of federal benefits to same-sex couples lawfully married in Massachusetts has not been adequately supported by any permissible federal interest."

Doma - enacted in 1996 during the Clinton administration - defines marriage for federal purposes as a union exclusively between a man and a woman.

President Barack Obama said last year that the Department of Justice would no longer defend the Doma.

Gay marriage is legal in eight US states and the District of Columbia. In May, Mr Obama endorsed gay marriage.