Chaos has engulfed the Andrews government's approach to juvenile detainees, with 15 youths to remain at Barwon Prison in the short term, despite the Victorian Supreme Court ruling on Wednesday that jailing them in an adult prison is illegal.

In extraordinary scenes, Justice Gregory Garde initially ordered that the children be removed from Barwon Prison by 4pm on Thursday and transferred to another remand centre in Victoria, before declaring he had no choice but to order them to stay for now.

Justice Garde ruled the children were being held illegally at the maximum-security facility, and their human rights were being breached. "All persons deprived of liberty must be treated with humanity," he said.

However, after hours of legal argument, Justice Garde accepted there were no suitable youth justice facilities in the state to take them.