The Supreme Court on Wednesday grappled with the question of whether the federal government can detain immigrants convicted of crimes for the duration of their removal proceedings after they have been released from criminal custody.

The hour-long argument on Justice Brett Kavanaugh's second day on the bench saw discussions among him and his eight fellow justices about the intentions of Congress when it implemented a federal statute allowing for mandatory detention of immigrants convicted of certain crimes without the possibility of a bond hearing.

The justices also spent significant time questioning what is considered to be a “reasonable” amount of time between when the immigrant is released from criminal custody and subsequently detained by the federal government for possible deportation.

The case involves Mony Preap, a Cambodian immigrant, and Bassam Yusuf Khoury, a Palestinian immigrant, both of whom are lawful permanent residents. Preap and Khoury were convicted of crimes and served their sentences, but were not detained by immigration authorities for removal proceedings until years after their release from criminal custody.

The statute in question says the federal government can detain immigrants convicted of crimes “when the alien is released” from criminal custody.

In their legal challenges, lawyers for Preap and Khoury, as well as other immigrants in similar circumstances, argue they are exempt from mandatory detention because of the gap in their custody, as the statute only applies if the immigrant is taken into immigration custody immediately upon release.

The 9th U.S. Circuit Court of Appeals agreed and in a 2016 ruling said mandatory detention applied only to immigrants detained right after they served their criminal sentences.

But the Trump administration argues that under the statute, immigrants convicted of crimes are subject to mandatory detention even if they are arrested by immigration authorities years after release from criminal custody.

In its petition to the Supreme Court, the federal government said that under the 9th Circuit’s ruling, “many criminal aliens will become exempt from mandatory custody for a reason — a gap in custody — that is ‘irrelevant for all other immigration purposes’ and often outside [the Department of Homeland Security’s] control.”

The Trump administration further warned that by exempting criminal immigrants from mandatory detention, many who obtain bond hearings will be released on bond and subsequently “flee or reoffend, thereby causing precisely the problems Congress enacted [the statute] to prevent.”

During oral arguments Wednesday, Justice Stephen Breyer expressed sharp concerns with the notion that immigrants who are released from criminal custody and return to their communities and families may be detained indefinitely years or decades later without the potential for bond.

Breyer posed a hypothetical scenario involving a grandfather who is detained by immigration authorities 50 years after committing a minor crime, an example that piqued the interest of Justice Neil Gorsuch. “50 years later, a minor crime, you say yes, the government must come and arrest him, right?” Gorsuch asked Zachary Tripp, a lawyer with the Justice Department.

The government’s position, Zachary Tripp, a lawyer for the Justice Department said, is that the immigrant could be arrested and detained without the potential for release on bond for the duration of removal proceedings.

“What you're doing to the individual is many who are no danger to the community, no danger to the community, you're depriving them of a hearing that could mean their release and you're keeping them instead or 11, 12, 13, 14 years,” Breyer said.

The justices also spent considerable time parsing what the standard should be for when detention must occur once an immigrant leaves criminal custody.

Chief Justice John Roberts noted the difference between a “reasonable degree of immediacy,” a standard set forth by the 9th Circuit, and a reasonable amount of time.

"Now which are you arguing for, reasonable degree of immediacy, which strikes me as a very short time, or a reasonable time?" he asked Cecilia Wang, a lawyer for the American Civil Liberties Union, which is representing the immigrants in the case. "Reasonable time would depend, for example, on the resources that are available to the Department of Homeland Security."

A reasonable degree of immediacy, however, "is something else," Roberts said. "That strikes me as a half hour or something, because, otherwise, it's not immediate."

Wang asked the court to affirm the 9th Circuit's ruling, which said the government should take an immigrant into custody with a "reasonable degree of immediacy."

"We think the same day would be appropriate," Wang said.

Kavanaugh tried to pin down from the government what the Trump administration would consider to be a reasonable time between release from criminal custody and detention by immigration authorities.

Tripp said placing such a time limit would be “really profoundly problematic,” because the gaps in custody are often several years long.

Kavanaugh also discussed Congress’s reasoning for implementing a statute that allowed for mandatory detention of certain immigrants without the potential to be released on bond. “What was really going through Congress's time in 1996 was harshness on this topic. Is that not right?” Kavanaugh asked

He further noted that Congress didn’t include a time limit in the statute and questioned whether the court should impose such a limit.

“That raises a real question for me whether we should be superimposing a time limit into the statute when Congress, at least as I read it, did not itself do so,” Kavanaugh said.

The Supreme Court agreed to consider the case in March and waited to decide whether to wade into the debate while it heard another case dealing with periodic bold hearings for detained immigrants.

A decision from the justices is expected by late June.