WASHINGTON — Gay-marriage advocates probably won’t get everything they want from the Supreme Court. They still might get a lot.

Two historic days of argument revealed that the court is at once divided and tentative on same-sex marriage. While the justices showed little appetite for legalizing such marriages nationwide, they suggested they might allow same-sex weddings to resume in California. A majority of the nine justices also indicated they might strike down a federal law that limits benefits to married gay couples.

That outcome “would be an important step toward allowing gay marriage everywhere,” said New York University law professor Barry Friedman. “It would send positive signals, it would avoid any serious backlash and, if current trends continue, it is only a matter of time” until more states allow same-sex nuptials. A ruling is likely by June.

Expectations were high among gay-marriage supporters in the weeks leading up to the arguments. Already buoyed by victories at the polls in four states, including Maine, last year, the movement gained more momentum when briefs filed by companies such as Apple and Morgan Stanley, leading Republicans like Jon Huntsman, and the Obama administration called on the court to back gay marriage.

From the start of this week’s arguments, the March 26 session on California’s Proposition 8, it was clear that the court was reluctant to establish a nationwide right to same-sex unions. The 2008 voter-passed initiative halted gay marriage in the state five months after California’s highest court had legalized it.

Justice Anthony Kennedy, the Supreme Court’s likely swing vote, asked whether the justices made a mistake when they agreed to review the law. Justice Sonia Sotomayor wondered aloud if it was too soon for the court to rule on gay marriage.

“We let issues perk, and so we let racial segregation perk for 50 years from 1898 to 1954,” she said.

Laurence Tribe, a constitutional law professor at Harvard Law School, said the court had “considerable sympathy for the idea of letting the issue percolate further at the state level rather than imposing a one size-fits all federal solution.”

Several justices suggested that the proposition’s sponsors lacked legal “standing” to appeal after a federal judge declared the measure unconstitutional in 2010. The standing issue is important because California state officials declined to defend Proposition 8 in court.

A Supreme Court decision based on lack of standing would reinstate a federal trial judge’s ruling that struck down Proposition 8. The two sides would then be left to fight over how far the judge’s ruling extends. Proposition 8 supporters say it would apply at most to the two gay couples challenging the law.

Opponents say the impact would be much broader, legalizing gay marriage in California, the most populous state. Its 38 million residents are 12.1 percent of the U.S. population of 314 million, according to a Census Bureau estimate in 2012.

“We would view that as a major win,” said Theodore Boutrous Jr., one of the lawyers challenging Proposition 8, in a telephone interview.

Although “we would like to win in the broadest possible way” with a nationwide right to gay marriage, Boutrous said, “it would again fuel the momentum in this country that we think our case has been part of causing.”

Public support for gay marriage is at record levels in opinion surveys. A Pew Research Center poll released last week found that 49 percent of adults supported legalization, with 44 percent opposed. Ten years earlier, a Pew poll found only 33 percent in support, with 58 percent opposed. Nine states and the District of Columbia now let gay couples marry.

The justices indicated they were more likely to issue a direct ruling on the Defense of Marriage Act, a 1996 law that defines marriage as being between a man and a woman and denies gay couples the benefits available to heterosexuals. The Obama administration is urging the court to strike down the law, known as DOMA.

Kennedy suggested that he viewed the law as overstepping the federal government’s authority because issues of marriage and children’s rights are historically decided by the states.

Justice Ruth Bader Ginsburg said that, under the law, states would have two kinds of marriage — “the full marriage and then this sort of skim milk marriage.” She suggested that would violate the constitutional guarantee of equal protection.

Kermit Roosevelt, a University of Pennsylvania law professor, said there was a 70 percent chance DOMA would be struck down. That and avoiding a broad constitutional ruling on gay marriage, he said, “would be a modest victory for gay rights, which is probably what the court wants at this point.”

Tribe agreed. “That will be a significant victory for same-sex marriage but is unlikely to be a landmark equality precedent,” he said.

Congressional Republicans support the law, arguing that it promotes traditional marriage and helps ensure that children grow up in a nurturing environment. They also contend that DOMA provides for uniform treatment of taxpayers in the various states.

The justices barely discussed the Obama administration’s argument that laws that treat gays differently should be given “heightened scrutiny,” a stricter standard used to protect racial minorities and women from discrimination. Giving gays such legal protection would buttress their challenges to laws barring gay marriage across the country.

Even if the court doesn’t afford gays heightened scrutiny, and instead strikes down DOMA as interfering with states’ rights, that would be a victory for gay rights, said Jenny S. Martinez, a Stanford Law School professor.

“That’s still a rejection of the argument that the federal government has a legitimate interest in not recognizing same-sex marriages,” Martinez said.

Some gay-marriage advocates are prepared to declare victory almost regardless of what the court says when it rules.

“What’s clear is that we have the momentum and we have the winning strategy, and we’re going to get there whether in June or the next round,” said Evan Wolfson, president of Freedom to Marry, a New York-based national gay-rights group.

Esme E. Deprez in New York and Bob Drummond in Washington contributed to this report.