WASHINGTON — A Supreme Court argument on Wednesday over the detention of immigrants during deportation proceedings seemed to expose a divide between President Trump’s two appointees, Justices Neil M. Gorsuch and Brett M. Kavanaugh.

The question in the case was whether the federal authorities must detain immigrants who had committed crimes, often minor ones, no matter how long ago they were released from criminal custody. Justice Kavanaugh said a 1996 federal law required detention even years later, without an opportunity for a bail hearing.

“What was really going through Congress’s mind in 1996 was harshness on this topic,” he said.

But Justice Gorsuch suggested that mandatory detentions of immigrants long after they completed their sentences could be problematic. “Is there any limit on the government’s power?” he asked.

Justice Stephen G. Breyer pressed the point, asking a lawyer for the federal government whether it could detain “a person 50 years later, who is on his death bed, after stealing some bus transfers” without a bail hearing “even though in this country a triple ax murderer is given a bail hearing.”