Mentally ill criminals should be dealt with in the community and not imprisoned, a group of MPs and peers has advised.
The all-party parliamentary group on prison health used a new report on Tuesday to describe the way jails deal with the mentally ill as "dysfunctional".
It said the present overcrowding in jails was making conditions worse for vulnerable inmates.
And it called for a "fundamental shift" in thinking, to keep the mentally ill out of prison.
The report said: "Perhaps future generations will look back on our generation, which has criminalised a large section of its mentally ill as being just as misguided as previous generations which exhibited the mentally ill as freaks.
"The bleak alternative is to continue with the present, clearly dysfunctional system, applying make-do and mend solutions to its broken parts."
Group chairman Fabian Hamilton said: "The evidence is overwhelming. We are trying to deal with people with mental health problems in a dysfunctional system.
"What is needed is a massive investment that provides high-quality support outside prison, but with the current crisis of overcrowding and the cost of keeping an individual in prison running at ?37,000 a year, we believe that will be money well spent.
"Court diversion and liaison schemes must be improved, so that offenders with mental health problems are diverted away from the criminal justice system to care and treatment from the health and social care sectors."
Lord Ramsbotham, a former chief inspector of prisons, added: "The problem posed by the very large numbers of prisoners with mental health problems has been ignored for far too long.
"It is time that the government responded with both short- and long-term plans, based on the evidence that has been available for years."
According to a survey carried out by the Office of National Statistics in 1997, 90 per cent of prisoners had at least one mental health disorder.