WASHINGTON — Concluding two days of intense debate, the Supreme Court signaled Wednesday that it could give a boost to same-sex marriage by striking down the federal law that denies legally married gay spouses a wide range of benefits offered to other couples.

As the court wrapped up its remarkable arguments over gay marriage in America, a majority of the justices indicated that they will invalidate part of the federal Defense of Marriage Act, if they can get past procedural problems similar to those that appeared to mark Tuesday’s case over California’s ban on same-sex marriage.

Since the federal law was enacted in 1996, nine states and the District of Columbia have made it legal for gays and lesbians to marry.

Same-sex unions also were legal in California for nearly five months in 2008 before the Proposition 8 ban.

Justice Anthony Kennedy, often the decisive vote in close cases, joined the four more liberal justices in raising questions Wednesday about a provision that defines marriage as the union of a man and a woman for purposes of federal law.

It affects more than 1,100 statutes in which marital status is relevant, dealing with tax breaks for married couples, Social Security survivor benefits and, for federal employees, health insurance and leave to care for spouses.

Kennedy said the Defense of Marriage Act appears to intrude on the power of states that have chosen to recognize same-sex marriages.

When so many federal statutes are affected, “which in our society means that the federal government is intertwined with the citizens’ day-to-day life, you are at real risk of running in conflict with what has always been thought to be the essence of the state police power, which is to regulate marriage, divorce, custody,” Kennedy said.

Other justices said the law creates what Justice Ruth Bader Ginsburg called two classes of marriage, full and “skim-milk marriage.”

If the court does strike down part of DOMA, it would represent a victory for gay-rights advocates. But it would be something short of the endorsement of gay marriage nationwide that some envisioned when the justices agreed in December to hear the federal case and the challenge to California’s ban on same-sex marriage.

Still, the tenor of the arguments over two days reflected how quickly attitudes have changed since large majorities in Congress passed the federal DOMA in 1996 and President Bill Clinton signed it into law.

In 2011 President Barack Obama abandoned the legal defense of the law in the face of several lawsuits, and last year Obama endorsed gay marriage. Clinton also has voiced regret for signing the law, and now supports allowing gays and lesbians to marry.

In 1996, the House of Representatives’ report on the legislation explained that one of its purposes was “to express moral disapproval of homosexuality.” Justice Elena Kagan read those words in the courtroom Wednesday, evoking a reaction from the audience that sounded like a cross between a gasp and nervous laughter.

Kagan’s quotation gave lawyer Paul Clement, representing the Republican-controlled House of Representatives that has taken up defense of the law in place of the administration, some uncomfortable moments at the lectern.

“Does the House report say that? Of course, the House report says that. And if that’s enough to invalidate the statute, then you should invalidate the statute,” Clement said.

He said the more relevant question is whether Congress had “any rational basis for the statute.” He supplied one — the federal government’s interest in treating same-sex couples the same no matter where they live.

Clement said the government does not want military families “to resist transfer from West Point to Fort Sill because they’re going to lose their benefits.” The U.S. Military Academy at West Point is in New York, where same-sex marriage is legal, and Fort Sill is in Oklahoma, where gay marriages are not legal.

Opposing Clement was the Obama administration’s top Supreme Court lawyer, Donald Verrilli, who said the provision of DOMA at issue, Section 3, impermissibly discriminates against gay people.

“I think it’s time for the court to recognize that this discrimination, excluding lawfully married gay and lesbian couples from federal benefits, cannot be reconciled with our fundamental commitment to equal treatment under law,” Verrilli said.

Verrilli and Roberta Kaplan, the lawyer for Edith Windsor, the 83-year-old New York woman who sued over DOMA, told the court that views about gay people and marriage have shifted dramatically since 1996, when the law was approved.

“Why are you so confident in that judgment? How many states permit gay couples to marry?” Justice Antonin Scalia asked Kaplan.

Nine, she said.

“So there’s been a sea change between now and 1996,” Scalia said, doubtfully.

Chief Justice John Roberts jumped on the idea of a rapid shift in opinion to suggest that perhaps gays and lesbians do not need special protection from the court.

“As far as I can tell, political leaders are falling all over themselves to endorse your side of the case,” Roberts said.

The justices stepped into the dispute after lower federal courts ruled against the measure.