The girl was thought to be the youngest child in Britain to invoke her rights under the Children Act 1989 when she first went to court in November last year.
She was 11 when she sought to 'divorce' her mother and be allowed to live with the foster family. The proceedings were later dropped when solicitors acting for the mother and daughter reached a compromise that the local authority should take over the case.
Mr Justice Eastham ruled at a hearing in chambers at the High Court in Leeds on Monday that the girl could stay with the foster parents and granted them a residence order. The girl's mother agreed to the ruling.
The girl was fostered with the family when she was three months old and continued to see them and go on holiday with them after returning to live with her mother eight years ago. She was said to be delighted with the decision.