A federal appeals court in Boston ruled the 1996 Defense of Marriage Act unconstitutional Thursday, setting up a likely Supreme Court battle on gay marriage sometime after the presidential election.

The decision is the second federal appeals ruling this year to side with gay-marriage proponents and comes weeks after President Barack Obama became the first president to say he believes same-sex couples should be able to wed. In February, a court in San Francisco struck down a California voter initiative that barred gay marriage.

Both sides expect the Supreme Court to eventually decide the two cases. Less clear is whether the court would reach a decision on whether gays and lesbians enjoy a constitutional right to marry. The two appellate-court decisions stopped short of making that judgment, ruling in favor of gay-marriage advocates on narrower grounds.

The Defense of Marriage Act, passed by bipartisan congressional majorities and signed by President Bill Clinton, says the federal government would only recognize marriages between a man and a woman. It prevents same-sex couples who married under state laws from receiving federal benefits such Social Security survivor payments and burial privileges in veterans' cemeteries.

In Thursday's opinion, a three-judge panel in the First Circuit Court of Appeals found that the law couldn't stand. Writing for the court, Judge Michael Boudin, an appointee of President George H.W. Bush, observed that Supreme Court precedents limit government's power to take action against "historically disadvantaged or unpopular" groups, including gays and lesbians. The 1996 law imposes "serious adverse consequences" on them, he wrote.