Mental health nurses are to be posted in police stations and courts in a bid to reduce reoffending by mentally ill criminals.
The £25 million pilot scheme, to be tested in Wiltshire, one of 10 areas across England, will mean that people with mental health problems are treated "as early as possible", care and support minister Norman Lamb said.
Identifying people with mental health needs who come into contact with the criminal justice system at the earliest possible stage will help to "divert" them away from offending again, Mr Lamb said.
He said that "too often" criminals with mental health problems, learning difficulties or substance misuse issues are only diagnosed once they reach prison.
The majority of people who end up in prison have a mental health problem, a substance misuse problem or a learning disability, and one in four has a severe mental health illness such as depression or psychosis, a Department of Health spokeswoman said.
Over the next year, the money will be used to join up police and courts systems with mental health services in Merseyside, London, Avon and Wiltshire, Leicester, Sussex, Dorset, Sunderland and Middlesbrough, Coventry, south Essex and Wakefield.
Mentally ill people as well as those with substance abuse problems and learning disabilities, will be assessed when they come into contact with police.
The information will be shared with officers and the courts system to ensure charging and sentencing decisions take into consideration a person's health needs, the spokeswoman said.
It will also mean treatment is given sooner which will help stop reoffending, she added.
If the pilot is successful, the measure will be rolled out across the rest of the country by 2017.
Mr Lamb said: "We want to help them get the right support and treatment as early as possible. Diverting the individual away from offending and helping to reduce the risk of more victims suffering due to further offences benefits everyone.
"That's why we are investing £25 million for liaison and diversion services at police services and courts across the country. These will help identify when someone in a police station or involved in court proceedings who has mental health problems are referred to the right mental health services and are given the help and support they need."
Policing minister Damian Green said: "Police officers should be focused on fighting crimes and people with mental health conditions should get the care they need as early as possible.
"These pilots will not only ensure that happens but in the longer term will help drive down reoffending by individuals who, with the right kind of treatment, can recover fully."
The move follows a similar scheme which sees nurses on patrol alongside police officers in a bid to improve responses to mental health emergencies.
Street triage teams are being tested across police forces in North Yorkshire, Devon and Cornwall, Sussex, Derbyshire, West Yorkshire, the West Midlands, Thames Valley and London, as well as British Transport Police.
As well as supporting police on patrol, the mental health nurses also assist officers when they are responding to emergency calls and give advice to staff in police control rooms.
The pilot mimics schemes already established in Leicestershire and Cleveland, which have shown that having nurses on hand can help to reduce the number of mentally ill people taken into custody and reduces demands on police time.
It has been estimated that police officers spend 15 per cent to 25 cent of their time dealing with mental health problems - the equivalent of around 26,000 officers.
Paul Jenkins, chief executive of charity Rethink Mental Illness, said: "All too often, the way our criminal justice system deals with people with mental health problems leads to poor outcomes for individuals, frustration from police officers, magistrates and others, and such a waste of resources as people are needlessly sent to prison through a failure to respond to some of the underlying issues in their lives.
"We welcome this initiative, which has the potential to stop people going unnecessarily to prison, reduce reoffending rates and save millions in taxpayers' money."