It would be difficult not to share the heartbreak of Alfie Evans’ parents. Alfie was a 23-month-old child who suffered from an undiagnosed degenerative disease that had led to a “catastrophic degradation of his brain tissue”. Yesterday he died.

Doctors at Liverpool’s Alder Hey children’s hospital, deeming that there was no possibility of recovery, had wanted for almost 10 months to switch off Alfie’s ventilation machine. His parents, Tom Evans and Kate James, disagreed, and fought through the courts both to maintain ventilation and to transfer him to a foreign hospital. Last week, a high court judge sided with the doctors.

In being pushed through the adversarial court system, the intense private anguish of the parents was turned into a grotesque public spectacle; a spectacle further polarised by religious leaders and politicians jumping on the bandwagon and whipping up emotions. The often abusive responses towards both Alder Hey medical staff and Alfie’s parents reveal once again the growing Twitterification of life.

Disputes between parents and doctors are becoming more common, thanks to social and medical changes. In such disputes, someone inevitably has to make the final decision. The trouble is, institutions designed to pronounce on criminal cases are not necessarily best placed to make judgments on complex moral dilemmas in which there may be no single “right” answer.

The problem is made worse by confusion over the criteria that courts use. In a medical case such as Alfie’s, a judge can overrule parents’ wishes if they are deemed not to be in the child’s “best interests”.

However, if social workers want to take a child into care then the criterion is not that of best interests but of “harm”. Even if parents are deemed not to be acting in the child’s best interests, a judge can only overrule their wishes if he is satisfied that, in the words of the 1989 Children Act, the child will “suffer significant harm”.

It seems incongruous that the criteria are so different in these cases. This was precisely the argument made by Alfie’s parents. As the supreme court judges summed up the parents’ view: “If significant harm (or its likelihood) has to be established before a child can be removed – perhaps only temporarily – from the home of his parents under a care order, why does it not need to be established before he can be removed, permanently, from them and from everything in this world, by death?”

It was a good question, and one the court failed properly to answer. The judges claimed that a higher threshold was required in imposing a care order “to avoid social engineering”. That seems an ad hoc argument with little real substance.

Usually, a decision about a child’s best interests involves two alternative futures. Is she, for instance, better off with her mother or father after divorce? Where courts have to decide whether to turn off life support, however, the choice is between a possible future and a definite non-future. After death, the child has no interests to debate.

This issue was at the heart of the tragic case of Charlie Gard last year. Charlie suffered from a rare genetic condition that caused catastrophic brain damage. Doctors wanted to switch off life support. His parents disagreed, pinning their hopes on an experimental treatment in the US, of which British doctors were sceptical. The courts decided it was not in Charlie’s best interests to receive further treatment and he should be permitted to die with dignity.

That decision may have been correct. But to deny the parents the right to treat Charlie further surely required particularly strong evidence that to do so would cause him harm?

In Charlie Gard’s case, there was a possibility chance of an alternative treatment (however slight the chance of success). In the case of Alfie Evans, no one expected him to live for long. Nevertheless, both cases highlight the problem of defining “best interest” and of trying to discover it through the court system. It is not clear, for instance, that it would have been against Alfie Evans’ best interest for him to have received palliative care in an Italian hospital, as his parents wanted, rather than in Liverpool.

The courts need both to acknowledge the difficulties in knowing what constitutes best interest and be particularly cautious about sanctioning death. At the same time, we need new means of resolving such cases, rather than hoping, as we do now, that institutions designed to provide justice in criminal cases can also help unpack delicate moral conundrums.