The girl had told her carers she wanted the termination and her parents had both consented. However, it was considered their consent was beyond their powers and a judge's declaration was needed.
Because of the urgency, Justice Margaret Wilson made the order in a special closed night court last week but did not release her written reasons until today.
The girl, 12, was 18 weeks pregnant and residing in a State Government-run public hospital.
Justice Wilson heard evidence from two psychiatrists and an obstetrician about the state of the child's mental health should the pregnancy not be terminated.
She noted it was thought the effect on her mental health would be far more serious and go beyond the normal dangers of childbirth. [..]
She also noted that the girl had the maturity of a nine-year-old.