A senior family court judge asked lawyers to observe a minute's silence after hearing how three of a couple's four children had fallen victim to similar illnesses and died.
All three - a girl aged eight months and twin boys aged 14 months - were thought to have been struck down by the same "unknown, genetic disorder", said Mr Justice Holman.
The little girl had died some time ago - the little boys had died recently after the judge ruled that life support machinery should be switched off.
Mr Justice Holman today handed down a ruling on the twins' case at a hearing in the Family Division of the High Court in London.
He began the hearing by asking everyone in the courtroom to stand in silence in memory of the children.
The judge said no-one who had not been in the couple's position could appreciate their "agony".
Mr Justice Holman was told that the family was Muslim and from Iraq and had arrived in England in December 2014 - and the couple had relatives living in areas controlled by the Islamic State.
He said he wanted to protect the couple's surviving four-year-old son - and ruled that no-one involved could be identified.
Bosses at the Central Manchester University Hospitals NHS Foundation Trust, who had responsibility for the twins' care, had asked the judge to rule that life-support treatment should end.
Barrister Lorraine Cavanagh, for the trust, said the twins had been in hospital for about eight months and were suffering from an "untreatable, progressive, neuro-degenerative disorder".
She said the trust had asked for a court ruling because specialists felt that further life-support treatment was futile and not in the twins' best interests. Specialists had not been able to diagnose the cause and the disorder was untreatable and incurable.
Clinicians felt that the twins were "unable to experience pleasure from comforting stimuli".
Miss Cavanagh said the boys' parents had been "struck by unimaginable tragedy" and suffered "unimaginable pain".
The couple wanted the twins to be kept alive. The boys' father told Mr Justice Holman that withdrawal of life-support treatment offended the family's Muslim beliefs. He said scientists might find a cure - and said the boys should be kept alive until a cure was found.
Mr Justice Holman concluded that it would be in the twins' best interests if life-support treatment was ended, after hearing evidence from specialists and the twins' father.
"The parents have an elder son, now aged four, who is healthy and normal," said the judge.
"They next had a baby daughter who, very tragically, died at the age of eight months. Her condition was not fully diagnosed; but, like that of these boys, it manifested itself in seizures and respiratory failure, and it now seems very likely that she and they were afflicted by the same, unknown, genetic disorder."
Mr Justice Holman said he was satisfied, after examining medical evidence, that the twins had "severely damaged" and "malfunctioning" brains.
"They are not functioning cognitively at all. These boys are merely artificially surviving," the judge said.
"Their situation is unquestionably irreversible, and can only deteriorate progressively further."
He added: "It seems to me that artificially to prolong their lives in this case lacks any purpose, confers no benefit at all apart from the fact of physical survival, and involves perpetuating the infliction of pain and discomfort for no gain or purpose. It is not in the best interests of either boy that the process be artificially prolonged."