A 12-year-old Irish girl being kept in an Isle of Man prison has been released on bail.
The girl, who cannot be named for legal reasons, had been sent to the juvenile wing of the Victorian prison in the island's capital, Douglas.
She is facing charges of assaulting staff at a care home and was sent to the prison last Wednesday.
The decision of the magistrates last week caused outrage among civil liberties and children's organisations.
The island's social services instructed the girl's solicitor to file a bail application to a Manx High Court judge in chambers yesterday.
The judge granted the application after hearing social services had allocated more resources to look after the girl.
The girl's mother has accused the social services of failing her daughter, who went into care when she was 10. The mother claimed: "Social services have put her through hell."
She said her daughter was born with a minor form of spina bifida, but social services in the island said the medical advice they had received was that there were no longer any difficulties.
The girl's father left home five years ago and is no longer in contact with the family. It is unclear whether he knows of his daughter's plight and he is believed to be back living in Ireland.