Washington (CNN) A divided Supreme Court Wednesday grappled with whether it is unlawful to subject thousands of immigrants fighting deportation to long-term detention without individualized bond hearings.

The case, brought by a class of immigrants who seek hearings to prove that they are neither flight risk nor a danger to society, comes at a time when immigration groups lament the fact that the Obama administration deported record numbers of immigrants and the Trump administration has vowed to crack down further on enforcement.

"Under the Obama administration, immigration detention has skyrocketed to record levels," said Cecilia Wang, the director of the ACLU Immigrants' Rights Project and a lawyer for the class of immigrants. Wang said the case "is fundamentally about whether the executive branch has unchecked power to detain someone without a hearing --something that is contrary to the most basic principles behind the founding of the United Sates."

Lower courts are divided on how they interpret the immigration detention statutes at issue in the case.

The liberal justices on the bench seemed sympathetic to parts of an opinion by the 9th Circuit Court of Appeals that ruled in favor of the class of immigrants, requiring an individualized procedure after six months of detention. The court stressed that while it was mandating that immigration judges hold hearings for certain individuals, it was not ordering them to release any single individual.

Read More