A High Court judge has warned "we will have blood on our hands" if appropriate care is not found for a suicidal teenager upon her release from a secure unit.
Sir James Munby, the most senior family court judge in England and Wales, revealed there are no places available for the girl in an "appropriate clinical setting" when she is freed in 11 days.
He said he felt "shame and embarrassment" that he "can do no more" for the girl, known only as X, in a judgment delivered in private in the High Court family division sitting in Manchester.
The judgment concerns a girl who has "on a large number of occasions" in a secure unit made "determined attempts to commit suicide".
Experts believe she needs to be placed in further care following her release, but so far no appropriate bed has been found.
Sir James said the only placement identified as an option for the girl has a six-month waiting list for beds, and he hit out at the "disgraceful and utterly shaming lack of proper provision" of support for vulnerable people in the country.
Staff at the unit where the girl is being held, referred to as ZX, have said sending her back to her home town would be a "suicide mission to a catastrophic level".
The judgment states: "Staff do not think it will take more than 24 to 48 hours before they receive a phone call stating that X has made a successful attempt on her life."
In his ruling, Sir James said the case "should make us all feel ashamed".
He said: "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.
"If, when in 11 days' time she is released from ZX, we, the system, society, the State, are unable to provide X with the supportive and safe placement she so desperately needs, and if, in consequence, she is enabled to make another attempt on her life, then I can only say, with bleak emphasis: we will have blood on our hands."
Sir James added: "What this case demonstrates, as if further demonstration is still required of what is a well-known scandal, is the disgraceful and utterly shaming lack of proper provision in this country of the clinical, residential and other support services so desperately needed by the increasing numbers of children and young people afflicted with the same kind of difficulties as X is burdened with.
"We are, even in these times of austerity, one of the richest countries in the world. Our children and young people are our future. X is part of our future.
"It is a disgrace to any country with pretensions to civilisation, compassion and, dare one say it, basic human decency, that a judge in 2017 should be faced with the problems thrown up by this case and should have to express himself in such terms."
The teenager must leave the unit no later than 3pm on August 14.
Sir James ordered that copies of the judgment be sent to Home Secretary Amber Rudd, Health Secretary Jeremy Hunt, Education Secretary Justine Greening and Justice Secretary David Lidington, as well as the chief executive of NHS England.
Liberal Democrat former health minister Norman Lamb called the judgment "a damning condemnation" and "a reflection of a failure of the system to provide support for families across the country".
Mr Lamb told BBC Radio 4's World At One there were "too many examples of failures of care", adding: "We are failing families across our country in a wholly unacceptable way."
Labour MP Luciana Berger, who previously served as shadow minister for mental health, tweeted: "Devastating judgement. @Jeremy_Hunt this can't wait. You need to fund some extra CAMHS beds today."
Conservative MP and former children's minister Tim Loughton wrote: "This is worrying and very significant from James Munby who is widely respected."
A spokesman for NHS England said: "We have heard the comments from the judge and completely agree that a solution must be found.
"Together with other agencies involved, we are continuing to make every effort to find the most appropriate care setting for this young woman."