A 17-year-old boy is no longer to be detained in the lock up at St. Patrick"s Institution following a High Court challenge.
The teenager is serving 3 years for burglary.
Lawyers for the teenager told the court the only explanation given by the authorities for locking him up 23-hours a day was that it was for his own protection.
Senior Counsel Remy Farrell said that he is a traveller and there is more than a suspicion that he has been locked in on the basis of his ethnicity.
He described lock-ins as something akin to a management tool.
The court was also told other obligations under prison rules were manifestly being ignored and that the teenager was being accommodated on mattress beside a toilet being used by adult prisoners.
Mr. Justice Michael Peart at this point ordered an investigation into the lawfulness of his detention.
But talks between the sides meant the case went no further.
It has been agreed the 17-year-old will be transferred within the institution.