A majority of Supreme Court justices on Wednesday indicated they could be inclined to strike down a law that denies federal benefits to legally married same-sex couples, a move that would reflect the evolving nationwide sea change in attitudes to gay marriage.

As a packed courtroom listened attentively on a second day of arguments on gay marriage, Justice Anthony Kennedy, a potential swing vote, warned of a "real risk" that the Defense of Marriage Act (DOMA) infringes on the traditional role of the states in defining marriage.

A conservative, Kennedy is viewed as a key vote on this issue in part because he has twice authored decisions in the past that were viewed as favorable to gay rights.

To date, nine states recognize gay marriage while 30 states have constitutional amendments banning it and others are in-between. Polls show growing support among Americans for gay marriage.

With the thousands who demonstrated on both sides of the issue during the court's oral arguments heading back home, the focus shifted to the internal conversation within the court over DOMA and California's Proposition 8 gay marriage ban, which the court weighed on Tuesday.

Rulings in both cases are expected by the end of June.

DOMA, enacted in 1996, denies married same-sex couples access to federal benefits by defining marriage as between a man and a woman. Kennedy referred to DOMA as "inconsistent" because it purports to give authority to the states to define marriage while limiting recognition of those determinations.

Before debating the larger issues in the case, the justices spent 50 minutes debating various procedural hurdles that could prevent the court from issuing a decision.

During that period, the high court's conservative wing took several slaps at President Barack Obama for abandoning legal defense of DOMA in 2011, a decision that left Republican lawmakers as its primary defenders. Despite this, it looked likely, but not definite, that the court will reach the merits.

'SKIM MILK MARRIAGE'

Kennedy's states' rights concerns were echoed by two of the liberal members of the bench, Justice Sonia Sotomayor and Justice Elena Kagan. "What gives the federal government the right to be concerned at all about what the definition of marriage is?" Sotomayor said.

Justice Ruth Bader Ginsburg and Justice Stephen Breyer also raised concerns about the law.

Ginsburg stressed how important federal recognition is to any person who is legally married.

"It affects every area of life," she said.

Comparing marriage status with types of milk, Ginsburg said that a gay marriage endorsed by a state, but not recognized by the federal government, creates two types of marriage, "full marriage, and then this sort of skim milk marriage."

If the court rules on the states' rights issue, the justices could strike down the law without deciding the bigger question of whether DOMA violates the U.S. Constitution's guarantee of equal protection under the law.

On that issue, Kagan spoke of a "red flag" that indicates Congress passed DOMA with the intent of targeting a group that is "not everyone's favorite group in the world."

Audible murmurs could be heard in the courtroom when Kagan quoted from a House of Representatives report, written at the time DOMA was considered, that referenced "moral disapproval" of gay marriage.

In a tangent from debating the case, several conservative justices criticized Obama and his Justice Department for not defending the marriage law in court.

Chief Justice John Roberts questioned whether Obama had "the courage of his convictions" for continuing to enforce DOMA while calling it invalid.