The U.S. Supreme Court agreed Monday to consider whether detained immigrants facing deportation must be allowed a bail hearing if they are held for at least six months, a decision that could have significant implications for immigrant-rights groups.

The case the court will hear dates back to 2010, when the American Civil Liberties Union brought a class-action suit against Immigrations and Customs Enforcement, a department of the federal government. The case includes about 1,000 immigrants in California who have been detained longer than six months, either for crossing the border illegally or because they were legal residents who committed deportable crimes. The ACLU argued that immigrants in detention centers who demonstrate that they will show up for court hearings and who pose no public threat deserve a right to a bail hearing. A California court ruled in favor of the ACLU, and on appeal, the Ninth U.S. Circuit Court of Appeals in San Francisco upheld the lower court’s ruling in 2015. The Obama administration appealed the Ninth Circuit’s ruling, which set it up for review on the Supreme Court docket.

Reuters reported that in its appeal of the ruling, the U.S. Department of Justice said:

…  the appeals court decision was “fundamentally wrong” because it dramatically expanded the number of people eligible for hearings and set a high bar for the government to argue that a detainee should not be released.

The ACLU responded in its court papers that the government had exaggerated the impact of the court injunction, which has been in place since 2012 and applies only to immigrants in the Los Angeles area.

The lead plaintiff in the case, Alejandro Rodriguez, was brought to the U.S. as an infant and became a legal permanent resident. In 2003, Rodriguez was convicted of drug possession and ordered to be deported. He spent three years in detention. Once an immigrant is held for at least six months, the average stay in a detention center in the Central District of California is 404 days. The ACLU argues that it is unconstitutional to hold someone for that long without a bail hearing.

The Court will hear the case in its next term, which begins in October and ends June 2017.