In my opinion criminality has many causes, they are however often closely related. Occasionally there are stupid laws and more often stupid intepretation of those laws.
There are individuals who are psychopaths, that is someone without conscience. Whether such people where born psychopathic or developed psychopathy because of how they were raised is an argument that has never been resolved. Commonly called nature v nuture. Whether such people can be helped/reformed/treated is a difficult question.
The same is true of people with borderline personality disorder where often behaviour can become uncontrolled and subsequently destructive. Can these people be helped/rehabilitated? There are those who believe ongoing nuturing might be beneficial, others belong in the lock up and throw away the key brigade.
There is also a large number of people who have had difficult upbringings that have left them without the emotional skills and often practical skills necessary to thrive. Some of these people find their way into criminality, perhaps because it is required to survive and others because as Bob Dylan put it, "when you ain't got nothing, you've got nothing to lose".
To give some context, when I started working in mental health services over 50 years ago at Knowle Hospital there were over 700 in patients. Approximately 100 were deemed accutely ill and might well recover. 350 were longstay patients many of whom had at one stage or another
fallen foul of the law, but were now 'medicated' and 'institutionalised' Another 250 were elderly mentally ill, many with dementia. Knowle provided services for Southampton, Eastleigh Southern Parishes, Fareham and Gosport. The elderly services only provided for Fareham and Gosport. Moorgreen providing the service for Southampton Eastleigh Southern Parishes. Winchester Prison Services will tell you they now deal with many who would have found themselves in Knowle or similar. General Hospitals are unable to discharge elderly people with complex needs/behaviour.. My point being particularly in respect of offending/disturbed adults is that often they find their way to prison because there are no alternatives.
Years ago we had functioning services, probation services that had staff adequately trained and funded, not now. We had highly skilled staff who would visit bridewells daily to consult with the police to determine whether there were prisoners who could be diverted out of the CJS into mental health services.
My overall point is if we don't try and work with those in the CJS we will need to build a lot more prisons. Sorry to witter on but some of the comments above need further thought in my humble opinion