A federal appeals court ruled unanimously Thursday that the federal law declaring marriage to be a union solely between a man and a woman discriminates against married same-sex couples by denying them the same benefits afforded to heterosexual couples — a ruling that could set the stage for the Supreme Court to review the issue as early as next year.

The decision, from the United States Court of Appeals for the First Circuit, in Boston, will have no immediate effect because the court stayed its ruling in anticipation of an appeal to the Supreme Court. Legal experts said the justices could agree as early as this fall to hear the case and arguments could come next spring, making it the first case involving the same-sex marriage law to be decided by the court.

While the case dealt narrowly with the question of federal benefits for same-sex couples — not with the legality of same-sex marriage itself — many scholars said it was a significant moment in civil rights.

“It is another illustration of the growing consensus of the judiciary about the unconstitutionality of discriminating against gays and lesbians in the realm of marriage,” said Geoffrey Stone, a professor of law at the University of Chicago.