The Supreme Court heard arguments about whether the government can indefinitely detain people facing deportation. (Carolyn Kaster/AP)

The Supreme Court’s liberal justices grilled a lawyer for the Obama administration Wednesday about whether the federal government has the right to indefinitely detain immigrants who are facing deportation.

The eight-member court struggled with how to resolve the issue, which has taken on increased importance because of President-elect Donald Trump’s vow to step up the already active deportation record of the Obama administration.

In particular, the court was considering whether immigrants facing deportation are entitled to bond hearings and possible release while fighting deportation if they have been held more than six months. That deadline was set by one of the appeals courts that has considered the issue. The kind of immigrants covered by this case include a wide range of people, from longtime legal residents to those who were detained upon first arriving in the country.

Acting Solicitor General Ian Heath Gershengorn told the justices that the range of immigrants covered is reason enough to reject the “one-size-fits-all” six-month detention limit imposed by U.S. Court of Appeals for the 9th Circuit in San Francisco. Such a deadline is not in the federal statute, which says the government “shall detain” immigrants facing deportation.

The Supreme Court has ruled in the past that undocumented immigrants are entitled to some form of due process when challenging their detention but also that brief detentions were allowed. Courts have interpreted that guidance in varying ways, with the appeals courts in San Francisco and New York requiring more procedural safeguards for those who would be held for months or even years.

The court’s liberals were skeptical of Gershengorn’s arguments in favor of the leeway Congress provided, and several questioned whether the Constitution allowed it.

“We are in an upended world when we think 14 months or 19 months is a reasonable time to detain a person,” said Justice Sonia Sotomayor.

Justice Stephen G. Breyer worried about someone who had served a criminal term, say for four years, and then faced a similar wait in detention while fighting deportation.

“Your punishment’s over, but you’ve got four more years here of punishment while we try to get to stage two, which is called the removal order,” Breyer said. “That’s what’s bothering me.”

But Gershengorn said the delay is often at the request of the immigrant facing deportation, who is trying to build a case for why he should remain in the country.

The representative of the immigrants at issue in the case is Alejandro Rodriguez, a lawful permanent resident who came to the United States as an infant. He was working as a dental assistant when the Department of Homeland Security began removal proceedings against him in response to a conviction for drug possession and an earlier conviction for joy riding.

Rodriguez was detained for three years before he was allowed to challenge his confinement. ACLU lawyer Ahilan T. Arulanantham said there were hundreds or thousands in similar situations.

“We’re just talking about the need for an inquiry, that is, the need for a hearing that is individualized rather than a categorical presumption that someone is a danger and flight risk,” Arulanantham said.

But Justice Samuel A. Alito Jr. said the federal statute does not support the request. “I’ll tell you, on the language of the statute, I think you have a pretty tough . . . argument,” Alito said.

When the lawyer said he had a constitutional argument as well, Justice Anthony M. Kennedy reminded him that the lower court had not ruled on the constitutionality of the federal law. “We do not have the constitutional issue before us,” Kennedy said.

Justice Elena Kagan said she did not think that kept the court from rendering a decision.

“It seems to me that it’s quite obvious what the court below thinks as to the constitutional question,” said Kagan, or else it would not have ordered the six-month reviews.

Then the court should have struck down the statute instead of rewriting it, Chief Justice John G. Roberts Jr. responded. “We can’t just write a different statute because we think it would be more administrable,” he said.

The case is Jennings v. Rodriguez.