In a vital decision for children in foster care, Mr Justice Scott Baker upheld new government regulations which forbid those with convictions for sexual or violent offences - however antique and however minor - from acting as fosterers or adoptive parents.
The regulations, the judge said, had been 'hastily drawn' in response to a notorious case where a foster parent abused children placed in his care and would have damaging repercussions which the government clearly had not fully anticipated.
But parliament had been entitled to decide, as a matter of policy, that 'the good of the many should prevail over the detriment of the few,' and the regulations - however flawed - had to be complied with by local authorites, the judge ruled.
The couple have been caring for the girls, aged seven and six, for the past two years with the approval of the courts and social services despite the grandfather's conviction in 1962 for having unlawful sexual intercourse with a 15-year-old girl.
The offence was 'clearly not trivial' as the grandfather was sentenced to three months' imprisonment, but the judge said everyone agreed he posed no threat to the girls and their placement with the grandparents was in their best interests.
Removal of the girls from their grandparents' foster care was 'almost unthinkable', said the judge, but the Children (Protection from Offenders Miscellaneous Amendments) Regulations which came into force in October 1997 gave Kent CC no choice in the matter.
The judge's decision means the grandparents can no longer act as foster parents, but the girls may be able to continue living with them if their grandparents take the alternative route of applying for a court residence order.
A residence order was very much a 'second best' to the children being formally placed in the grandparents' care, but the judge said the terms of the regulations were clear.
The regulations left 'no discretion' with local authorities or adoption agents to place children for fostering or adoption with anyone who - however long ago - had been convicted or cautioned for specified offences of a sexual or violent nature.
The regulations also apply to all households containing anyone with a relevant conviction.
Kent CC claimed the regulations would have 'very serious consequences' by removing local authority independent discretion to decide what is in the best interests of a child's welfare.
The council pointed to ten cases where foster parents - who have cared for hundreds of foster children between them - will no longer be able to have children in their care because of often trivial offences they committed in their dim and distant pasts.
In one case a foster father from Worcestershire had been convicted 23 years ago for having sex with his 16-year-old girlfriend but had now been happily married for many years and had, over the years, cared for 275-300 children, some from very disturbed backgrounds.
Another parent from Nottinghamshire convicted of a sexual offence 43 years ago since when he has had dozens of foster children through his hands will also now lose his foster parent status because of the regulations.
But the judge said the regulations had been brought in in response to the notorious case of Roger Saint with whom numerous children had been placed by various local authorities despite his conviction for an indecent assault on a 12-year-old boy in 1992.
He was later sentenced to six-and-a-half years imprisonment for serious sexual abuse of several children who had been in his care.
Mr Justice Scott Baker remarked: 'The case of Roger Saint is not by any means the only case where children have suffered at the hands of unsuitable foster parents who should never have been permitted to their care.'
The evidence was that several local authorities had 'failed to exercise sound professional judgement' when making foster placements.
'No one can doubt the need to protect vulnerable children from the sexual predators who regrettably circulate in our society,' the judge added.
But he remarked: 'The problem thrown up by the present case is from the backwash of hastily drawn legislation.'
The regulations inevitably meant some children's lives were 'going to be subject to unwanted and detrimental upheaval' and the department of health had 'probably underestimated the number of children who are adversely affected.'
But, upholding the legality of the regulations, the judge said: 'Police decisions are matters for parliament and not for the court.'
'The legislators are entitled to conclude as a matter of policy that the good of the many should prevail over the detriment of the few.
'What led to the offenders regulations was a failure by some local authorities to exercise the discretion that they previously been given with sufficient vigour to stop those who ought not to be looking after children from caring for them.
'There are real indications that by taking away the decision makers' discretion altogether the pendulum has swung too far the other way.
'I can well see that those with convictions for specified offences should ordinarily be disqualified from fostering or adopting.
'But where the offence occurred long ago or the circumstances were unusual, there may be a good reason for supposing the offender no longer presents, ir he ever did, a significant risk to children.'
The judge urged the department of health to look again at the regulations with a view to increasing the class of those who may act as foster or adoptive parents and to restoring, at least in part, local authority discretion in such matters.
Foster parents, including the grandparents involved in the case, may also take some comfort from a court of appeal judgement earlier this month which may enable them to hold onto children by applying for court residence orders.