Sir Stephen Brown, President of the Family Division of the High Court, said it was in Edita Keranovic's best interests that she should stay in Britain with the couple, Alan and Deborah Fowler, for the foreseeable future.
"Her young life must not be shattered again," the judge said.
But Sir Stephen also ruled that the couple will never be able to adopt the child. And he said she should keep contact with her surviving relatives, who have fought for her return and were yesterday said to be "distraught".
In a statement issued by their solicitors, the Bosnian family said that after four years of searching and litigation, they were "very, very upset and disappointed" that Edita should not return to them.
"When our family was massacred in Bosnia we could somehow come to terms with that as they were all gone.
"Edita is all that remains and we cannot be together. She is our child and she belongs to us," Edita's 58-year-old grandfather, Hasan Keranovic, said.
Sir Stephen said that he understood that Edita's true family felt "angry and cheated", and the court recognised the "wrong which they have suffered". "But the court has now to consider first and foremost the interest of Edita," the judge said.
Edita was just nine weeks old when Serb troops attacked a garage where women and children from her home village of Hrustovo had gone to shelter.
Edita's mother and younger brother were killed, as were her grandmother, two aunts and two cousins. Edita and her cousin, Melvina, were retrieved alive from under the bodies of their mothers by a Serb officer, who handed the babies to neighbours.
Edita, who had three pellets lodged in her brain, was first taken to an orphanage and then brought to Britain for medical treatment, assisted by Mr Fowler, 62, and his 49-year-old wife.
The couple adopted Edita at Oxford County Court. But the order was later set aside afterinvestigations showed that members of the child's family had escaped from Bosnia and were living as refugees in Switzerland, a fact known to the Fowlers.
Sir Stephen said that he was satisfied that Mr and Mrs Fowler knew from an early stage that their adoption of the young girl - who will be five next month - was forbidden.
Faced with the "determined opposition" of members of Edita's family, Oxfordshire County Council, the adoption agency, and advice from the Official Solicitor, the couple had decided at the start of the latest hearing to drop the adoption application.
Although there had been "appalling irresponsibility" on the part of Mr and Mrs Fowler over their actions in trying to adopt Edita, the child should remain with them, Sir Stephen said.
"I believe that Mr and Mrs Fowler ... are nevertheless capable of acting in Edita's interests now that the whole situation has been revealed."
His decision was praised by Barbara Mostyn, of the Campaign for Inter- Country Adoption, who said cases like Edita's may become increasingly common as families trace evacuated Bosnian children.
"In a war situation you can understand a care worker would be delighted to think a child will leave such a horrendous situation. Their ability to trace surviving relatives at that time would be absolutely zero," Mrs Mostyn said.
She added: "I think the judge in many ways has ruled in favour of the child but not the relatives.
"If she retains links with her family, hopefully they can forge a relationship."Reuse content