“I’m not sure it’s necessary to get into sexual orientation to resolve this case,” he said. “I mean, if Sue loves Joe and Tom loves Joe, Sue can marry him and Tom can’t. And the difference is based upon their different sex. Why isn’t that a straightforward question of sexual discrimination?”

That theory had gotten only slight attention in scores of lawsuits challenging bans on same-sex marriage, and it is unlikely to serve as the central rationale if a majority of the court votes to strike down such bans, an opinion likely to be written by Justice Anthony M. Kennedy.

But it could allow Chief Justice Roberts to be part of a 6-to-3 decision, maintaining some control over the court he leads and avoiding accusations from gay rights groups that he was on the wrong side of history.

Image

Chief Justice John G. Roberts Jr. at the State of the Union address last year. On Tuesday, he hinted at a rationale for supporting same-sex marriage.CreditChip Somodevilla/Getty Images

“This would be a clean, formalistic way for the court to resolve the case,” Andrew Koppelman, a law professor at Northwestern University, said in an interview. “It could just apply existing sex discrimination law.”

Professor Koppelman and other scholars filed a brief urging the court to strike down the four same-sex marriage bans before it on sex-discrimination grounds. The chief justice’s musings were similar to a passage in the brief.

“If Ann is permitted to marry Bob, but Charles may not marry Bob,” it said, “then Charles is being discriminated against on the basis of sex.”

A basic premise of Chief Justice Roberts’s question was that the issue before the court is not “gay marriage.” Same-sex marriage bans, after all, do not prohibit gay people from getting married. A gay man, for instance, is free to marry a lesbian in all 50 states. What same-sex marriage bans do is bar people of the same sex, gay or straight, from getting married.

John J. Bursch, a lawyer defending same-sex marriage bans, had two responses in court to the chief justice’s question. First, he said, it is sex discrimination only if the two sexes are treated differently, but the bans place equivalent burdens on men and women.

Ilya Somin, a law professor at George Mason University, wrote on The Volokh Conspiracy, a blog about law, that the problem with this argument “is that, by the same reasoning, laws banning interracial marriage don’t discriminate on the basis of race.”

Indeed, courts for years justified bans on interracial marriage on such a “separate but equal” rationale.

Mr. Bursch’s second argument was that it is sometimes “appropriate to draw lines based on sex if it’s related to biology.” He reminded the court that in 2001 it had sustained a federal law making it harder for the children of American fathers to obtain United States citizenship than the children of American mothers.

But there was a logic to that distinction, Justice Ruth Bader Ginsburg responded. “The court’s rationale for that was: We know who the mother is. We’re fearful that the father is claiming to be the father for some benefits that he’s going to get from that status, but we can’t be sure he is the father,” she said.

In the end, Justice Ginsburg said, fathers were merely made to work a little harder to establish their status. “He just had to do some things that the mother didn’t have to do,” she said. “It wasn’t difficult. Here it’s a total exclusion.”

Having raised the point that prompted the discussion, Chief Justice Roberts did not pursue it. But if he wants to vote in favor of same-sex marriage, he may have found a modest path that would not require revision of constitutional standards for discrimination based on sexual orientation.

In another way, the rationale was powerful, because there is no question that laws that draw distinctions based on gender are subject to searching judicial scrutiny. But such gender-based scrutiny may have no role to play in other gay rights cases.

Even before the argument, at least one law professor predicted that Chief Justice Roberts might find the theory attractive enough to rely on it when the court issues its decision in June.

“Not wanting Justice Kennedy to monopolize the glory,” Eric J. Segall, a law professor at Georgia State University, wrote on Monday on the blog of the American Constitution Society, Chief Justice Roberts “will concur in the result striking down the same-sex marriage bans on the basis that they amount to unconstitutional gender discrimination.”

If Justice Kennedy writes a majority opinion establishing a nationwide right to same-sex marriage, he will probably rely on different constitutional principles, ones grounded in sexual orientation rather than gender. But the sex-discrimination rationale has intrigued him in the past.

He raised the point in 2013 when the court last considered whether there is a constitutional right to same-sex marriage. “Do you believe this can be treated as a gender-based classification?” Justice Kennedy asked a lawyer defending Proposition 8, California’s same-sex marriage ban.

He did not wait for an answer. “It’s a difficult question,” Justice Kennedy said, “and I’ve been trying to wrestle with it.”

Some lower courts have relied on sex discrimination to strike down same-sex marriage bans. In November, a federal judge in Missouri used language much like the chief justice’s.

“The state would permit Jack and Jill to be married but not Jack and John,” Judge Ortrie D. Smith wrote. “Why? Because in the latter example, the person Jack wishes to marry is male. The state’s permission to marry depends on the genders of the participants.”

“I was delighted that Chief Justice Roberts highlighted the sex discrimination in laws that forbid same-sex couples from marrying,” she said. “This important point has been made by judges in the lower courts and deserves the high court’s attention in these cases.”

A version of this article appears in print on , on Page A14 of the New York edition with the headline: Gender Bias Issue Could Sway Chief Justice. Order Reprints | Today’s Paper | Subscribe