These were not ordinary circumstances and I hope that the law does not apply in this case. Seems to me that a decision had to be made and that the doctor made that decision based on professional judgement. Under normal circumstances, a doctor would not have to make that decision. It took courage to accept that responsibility.
When legal guardians aren't around, professionals must act as judicious parents. If you had the choice, would you leave a child to die a lonely, slow and painful death or would you help them to die without pain? Who else, given the circumstances, could make that decision? What was the alternative?