The outgoing president of the family division has alluded to how important it is that children and young people have access to proper mental health support as he congratulated a teenager, once at risk of taking her own life, for the progress she has made in a case which he warned could have left society with 'blood on our hands'.

Sir James Munby described his judgment, In the matter of X (A Child), as a 'very short coda' to a case in which he has handed down five judgments.

He recalled, in his sixth judgment, that X 'was a very disturbed teenager, excessively prone to self-harming behaviour, including many suicide attempts'. In August 2017 she was transferred, in accordance with section 47 of the Mental Health Act 1983, 'from the wholly unsuitable secure accommodation' in which she was previously detained under a detention and training order imposed by the Youth Court to the clinical setting of an adolescent low-secure unit 'which she so desperately needed'.

The case made national headlines last year when Munby warned that 'the system, society and the state ...will have blood on our hands' if a 'supportive and safe' placement could not be found for X when she was released from youth custody.

Munby said counsel for the local authority, Michael Jones, had kept him informed of developments. In January, Jones said X's progress had been, on the whole, very positive. She was formally discharged from the secure unit the following month and returned home. Professionals and X's mum reported that she was 'happy, calm and settled' and 'like the old X'. Jones said: 'Given the situation the court faced last year...it is fair to say that her progress, having accessed the treatment she so desperately needed, has been nothing short of phenomenal.'

Munby said comment was 'superfluous' but congratulated X on her achievement and wished her 'the very best for the future'. He concluded: 'I cannot help wondering where X would be today if she had not, in the nick of time, received the appropriate clinical assistance she so desperately needed. That said, I leave it to others to ponder the moral of this story.'

Munby will step down as family division president in July.