The 63-year-old man challenged his detention because he was put in a shared cell which gave the three prisoners only four square metres of space to move in.
The cell had so little daylight that a light was on around the clock.
The judicial authorities found that the conditions violated the terms of the European Human Rights Convention, and in an unprecedented move ordered his release.
The man, who had been arrested for an alleged sex crime last week, has been allowed to return home until next week’s trial but must wear an electronic bracelet.
The conditions at Camp-Est have long been decried,
Last year, the Controller General of Prisons noted that two-thirds of the 239 cells were shipping containers used to house more than 330 people, making temperatures at the height of summer unbearable.
A report said no establishment in mainland France would tolerate such conditions.