When Mark Neary fell ill his son Steven, who suffers from autism, went into a care unit. His pre-planned stay was meant to be for three days but when Mark came to collect him, social workers at Hillingdon borough council said that they would not release Steven because they thought he was a danger to the public. A court ruling on whether Steven should be released back to his father is due in June.

Steven's case is unusual, but locking people up with mental health difficulties who may or may not be "dangerous" is not. It happened to Scott Maloney. In 2004, five weeks from the end of a six-year prison sentence for wounding with intent, Maloney was transferred to Rampton high-security psychiatric hospital, where they told him he would be locked up for at least eight years.

It was his past that put him there. Physically and sexually abused as a child, Maloney had spent more of his teens inside mental hospitals and prisons than out. Whenever he got in trouble, Maloney – on dubious advice – told people that he was hearing voices. The psychiatric reports piled up. One report, prepared for a hearing on whether he could ever see his then unborn daughter, Chloé, said he was a dangerous psychopath whose condition was "untreatable". Maloney, who was 19, was prevented from being present at Chloé's birth. A few weeks later he got drunk and cut someone up with a bottle.

Section 47 of the Mental Health Act, which consigned Maloney to Rampton, requires reports from two doctors to say the prisoner is suffering from a mental disorder and that it is "appropriate" for him to be detained for medical treatment. His claims of hearing voices and past bad behaviour had come back to bite him. He was convinced it was all about convenience: no one wanted him released so they dumped him in Rampton to rot.

Maloney pinned his hopes on a mental health review tribunal, and argued that since one of the reports said he was "untreatable" he would therefore not benefit from being at Rampton. The tribunal rejected his application. At Rampton, it can take 25 years to be judged untreatable. Maloney didn't have that kind of time. He wanted out. He wanted to see his daughter. He knew he wasn't mad, no matter what the reports said. His behaviour got worse.

He staged dirty protests and smashed up his cell. He spent more and more time in a seclusion unit. He smashed that up, too. They sent him to a special ward, which housed the likes of Ian Huntley. Maloney's desire to get out of Rampton was leading him deeper and deeper in: his new ward had two-room cells. By holding the inner door shut, Maloney fooled the guard into not checking whether the outer door was locked. Once he was gone, Maloney slipped out of his cell. He planned to stage a roof-top protest but all the exits off the ward were locked so he destroyed the place. They found him in the morning holding a clipboard, smeared in his own faeces.

The director himself paid Maloney a visit. He had one question: "How much of a prison sentence do you have left?" Maloney had long since served his sentence, but it set him thinking. What if he were to get a new sentence? Would Rampton release him to prison? Despite the endless reports diagnosing schizophrenia and dangerous personality disorders, his psychiatrist's answer was "yes".

Maloney needed a criminal offence. He confessed to crimes for which he'd never been convicted. The police ignored him. He then wrote a letter, which he knew his psychiatrist would see, threatening to kill him along with a long list of Rampton staff. His psychiatrist, working in conjunction with Maloney, asked him what he wanted him to do with the letter. They sent it to the police.

Their ruse worked. Maloney pleaded guilty and got 18 months. After two and a half years in Rampton, he had escaped. Maloney served his sentence and got out. He did finally see his daughter, but only once. She was already eight years old.

Maloney's life was blighted by our mental health laws because it suits society to have him out the way. Steven Neary's life with his father remains at risk.