But it wasn't clear that they would arrive at the same conclusion.
The question was whether federal law requires authorities to detain - without a bond hearing - those legally in the country who have committed certain crimes that make them eligible for deportation. On the other side in the case were immigrants who had been in the U.S. in some cases for years without incident after completing their jail terms. But they were picked up and held in detention without a chance for release while fighting the deportation orders.
Justice Neil Gorsuch, confirmed to the court in 2017, seemed concerned that the law gave federal officials too much power to bring in such people even decades after they had completed sentences for what could be somewhat minor crimes.
"Is there any limit on the government's power?" Gorsuch asked Department of Justice lawyer Zachary Tripp.
New Justice Brett Kavanaugh, on the other hand, noted that might be a reason for the court not to impose a time constraint on the government.
"Congress knew it wouldn't be immediate, and yet Congress did not put in a time limit," Kavanaugh told Cecillia Wang, a lawyer for the American Civil Liberties Union, representing a class of people who had been detained.
"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."
As is often the case, the justices were debating what lower courts have found to be ambiguous wording in a federal statute. It says the attorney general "shall take into custody any alien" who has committed certain offenses "when the alien is released."
That when is what the case was about.
The U.S. Court of Appeals for the 9th Circuit interpreted "when" to mean right after the completion of someone's criminal sentence.
In the case before the court, Mony Preap was born in a refugee camp after his parents fled Cambodia, and he has lived legally in the United States since 1981. He was convicted in 2006 of marijuana possession - a conviction that could have led to his deportation - but was not picked up by federal authorities after he was sentenced to time served.
He served another criminal sentence for battery in 2013, a charge that is not a deportable offense. But he was picked up and detained for months without a hearing, though he was later released and no longer faces deportation.
Tripp said Congress knew when writing the statute that federal authorities should not be expected to pick up someone the moment they walk out of custody. And the government has complained that a lack of cooperation from authorities in "sanctuary communities" complicates their work.
The Obama administration held the same view of the law's requirements, but the Trump administration has placed more emphasis on deportations.
Justice Samuel Alito, like Kavanaugh, wondered if the court had a role in questioning what Congress wanted.
"I can see the equities when the alien has been free for a number of years, "Alito said. "But Congress, wisely or not, thought that this class of aliens was dangerous and they should not be trusted. Bail hearings were unreliable."
But Justices Sonia Sotomayor and Stephen Breyer said reading the law as the government had could raise what Breyer called "huge" constitutional problems.
He noted some of those eligible for detention and deportion had been in the country for years and had committed minor crimes.
"You think a person 50 years later, who is on his death bed, after stealing some bus transfers, that this [law] says that the attorney general shall release him and hold him without bail?" Breyer asked.
Even a "triple ax murderer" is entitled to a hearing" Breyer said.
The case is Nielson v. Preap.