The US Department of Justice last Friday admitted to a huge mistake.

It told the Supreme Court that it made “several significant errors” when providing data in a 2003 immigration case called Demore v. Kim. This was no small “oops.” There is no telling what impact the real figures might have had on the court’s ruling, which relied on these figures. The decision has allowed the prolonged, mandatory detention of hundreds of thousands of immigrants in the years since then.

Click to expand Image Melida Ruiz, a lawful permanent resident, pictured with her daughter, Mercedez Ruiz, and her grandson, Christopher Gonzalez. In 2011, Melida was held in immigration detention for seven months while she fought deportation based on a 2002 misdemeanor drug conviction, her sole conviction in more than 30 years in the United States. © 2013 Platon for Human Rights Watch

In Demore v. Kim, the Supreme Court upheld the constitutionality of a “mandatory detention” law that requires immigrants who were previously convicted of a wide range of crimes, and who have completed their sentences, if any, to be detained without bond while their deportation cases are pending. This includes green card holders.

For example, Ricardo F., a permanent resident with United States citizen family, was placed in mandatory detention in 2013, because of two 12-year-old marijuana possession convictions for which he served no time in jail.

In deciding Demore, the Supreme Court relied on the US government’s assertion that a deportation appeal, and therefore mandatory detention, generally lasts four months on average. In last week’s correction, the Justice Department admitted the average detention period was actually over one year, and suggested the Supreme Court “may wish to amend its opinion to delete” the error.

Since Demore, hundreds of thousands of people have fought their immigration cases while locked up. Detention severely diminishes a person’s odds of obtaining a lawyer or winning his or her case. Detention has a devastating impact on families, who struggle financially and emotionally without a breadwinner and parent. Detention also subjects people to harsh conditions, including subpar medical care that in the worst cases, results in death. The government’s mistake may have led to deadly deportations as well, by leading people who had suffered persecution or torture to give up their claims for refugee protection in desperation, to escape prolonged detention.

The Court and Congress should do more than “delete” the error. This winter, the Court will hear arguments in Rodriguez v. Jennings, an appeal from a Ninth Circuit decision that ruled immigrants in mandatory detention should get bond hearings after six months; it should take the real facts of mandatory detention into account. The ultimate responsibility lies with Congress. It should end mandatory detention and ensure everyone gets a hearing on whether it is necessary to detain them.