The Head of the Family Division warned that he and the state would have ‘blood on our hands’ if a hospital bed was not found for a teenager due to be released from youth custody.

In an unprecedented speech, Sir James Munby said he felt ‘powerless’ that he was unable to do more to help the 17-year-old, known as X, who had made several ‘determined’ attempts to commit suicide, after he was told there were not enough beds in the country.

He said: ‘If this is the best we can do for X, and others in similar crisis, what right do we, what right do the system, our society and indeed the state itself, have to call ourselves civilised?

‘The honest answer to this question should make us all feel ashamed. For my own part, acutely conscious of my powerlessness – of my inability to do more for X – I feel shame and embarrassment; shame, as a human being, as a citizen and as an agent of the state, embarrassment as president of the family division, and, as such, head of family justice, that I can do no more for X.’

Days later, Mr Justice Mostyn warned the government to reform child maintenance rules, as he ordered a father with assets of more than £5m, but who said he could only afford to pay £7 a week, to pay £20,000.