It comes four days before the parents of Charlie Gard are to challenge the decision in the Supreme Court.
Chris Gard and Connie Yates want their 10-month-old son to undergo specialist treatment in the USA.
But doctors at Great Ormond Street Hospital in London say the treatment is experimental and will not help.
In April, a High Court judge ruled against the parents' wishes and in favour of Great Ormond Street doctors.
Mr Justice Francis concluded that life support treatment should end and said Charlie should be allowed to die with dignity.
Three Appeal Court judges upheld that ruling last month.
Mr Gard and Ms Yates are to take their case to the Supreme Court on Thursday,
Lord Justice McFarlane, Lady Justice King and Lord Justice Sales published the reasoning behind their ruling on the British and Irish Legal Information Institute website earlier.
In the ruling the judges suggest there is no alternative treatment for Charlie.
It adds: "The sole principle is that the best interests of the child must prevail and that must apply even to cases where parents, for the best of motives, hold on to some alternative view."
The "unanimous" view of doctors treating Charlie was that moving him to the US for therapy was likely to "expose him to continued pain, suffering and distress", Lord Justice McFarlane added.
Lady Justice King said: "I would wish to acknowledge the skill and care given to Charlie by the doctors and nurses at Great Ormond Street.
"The fact that, for wholly understandable reasons, the parents have been unable to accept the view of the hospital that Charlie should now receive only palliative care, should not be interpreted as undermining any recognition of the dedication of the medical team who wish only to act in Charlie's interests."
Three Court of Appeal judges who ruled doctors should stop treating a baby at the centre of a legal fight have published their ruling on the case.