Civil liberties campaigners on the Isle of Man have promised to take the case of the girl, who had not been convicted of any offence and suffers from spina bifida, to the United Nations Committee on the Rights of the Child.
Mr Hartley said the girl, who lived in a children's' home, was considered a danger to herself and others.
He said: "I told her that she could be granted bail if she continued to live at the children's home and did not go out unaccompanied. The girl refused to accept these conditions and so I was left with no alternative.
"I have three children and many grandchildren - including a grandson the same age as the girl - and I did not take the decision to send her to the juvenile unit lightly."
The girl is being kept in a cell at special annexe of the prison inside the perimeter wall of Victoria Road Prison in Douglas. She is kept away from adult inmates but can associate with offenders aged up to 16.
A 15-year-old youth is at the same jail where he is thought to be serving a six-month sentence for assault and theft. A 14-year-old boy awaiting trial was released a few days ago when his parents agreed to take care of him.
A Manx advocate, Terence McDonald, has called for the island's government to carry out urgent reforms. "It is barbaric to lock up children in jail and place them in cells," he said.
Mr Hartley, a member of the prison board, said: "It is a modern unit, with specially trained staff and I believe the girl will receive the care she needs."
The girl, who is not being named, first appeared before Mr Hartley on Tuesday charged with assault and criminal damage. He said: "The police requested a remand in custody and it was considered the girl was in moral danger as she tended to go missing for lengthy periods and the staff at the children's home could not control her."