Section 51C. If a parent or other person requests the release from a hospital of a child reported pursuant to section fifty-one A, the presiding judge of the juvenile court of the judicial district in which such hospital is located may, if he believes such release would be detrimental to the child's health or safety, authorize the hospital and the attending physician, by any means of communication, to keep such a child in the hospital until custody is transferred to the department or until a hearing may be held relative to the care and custody of such child.
Any other physician treating a child reported pursuant to section fifty-one A may be so authorized by the court to keep such child in his custody until such time as the custody of the child has been transferred to the department or until a hearing may be held relative to the care and custody of such child.