LONDON — Bethany is 18 years old. She also lives with autism. And, for most of the last three years, she has been locked away in tiny rooms of psychiatric hospitals across Britain, with almost no human contact.

Matt Hancock, Britain’s health secretary, publicly apologized to her on Saturday “for the things that have gone wrong in her care.” Calling her case “incredibly difficult and complex,” he said that she was set to be moved to “a more appropriate setting before Christmas.”

The case has drawn national attention to the detention of hundreds of young people with autism or learning disabilities in Britain, and prompted an inquiry into the mental health system by a committee in Parliament. The conditions were so dire, the committee said, that the lawmakers had “lost confidence” in the system and its regulators.

“The brutal truth is that we are failing to protect some of the most vulnerable young people,” the Joint Committee of Human Rights said in a report released this month. “Indeed, we are inflicting terrible suffering on those detained in mental health hospitals and causing anguish to their distraught families.”