Mandatory drug testing of prisoners in Edinburgh is to start under new powers given to police.
The scheme is taking place at St Leonard's Police Station
Testing prisoners who are in the custody suite of St Leonard's Police Station will start on Tuesday.
The new powers, introduced by the Scottish Executive, involve the police testing prisoners for heroin and cocaine from saliva.
Mandatory drug testing on arrest comes under the Police, Public Order and Criminal Justice (Scotland) Act 2006.
The police and courts will use the results of the tests to inform bail and sentencing decisions but primarily seeks to refer drug addicts into treatment programmes to break the cycle of offending.
Similar schemes introduced by the Home Office in England and Wales have delivered significant reductions in offending rates and policing and public health costs.
Ch Supt George Simpson, divisional commander for Edinburgh, said "This scheme will result in us testing around 6,000 prisoners each year for the presence of heroin and cocaine.
"These results will help the police, courts and other social agencies in dealing more effectively with those drug users who fund their habit through criminal lifestyles."
Justice Secretary Kenny MacAskill, said: "We need to look at innovative ways of breaking the cycle between drug addiction and crime and this pilot will help police begin to achieve this.
"Drugs are one of the great social problems of our age. This programme aims to help problem users get off drugs, into treatment and away from crime, but we know there are no quick fixes to this complex issue.
"Around three-quarters of those sentenced by the courts to a custodial sentence show signs of drug misuse and drug-related offending.
"We need to improve access to effective interventions for those suffering from addiction while at the same time being tough on drug dealers."
The Lothian and Borders initiative is one of only three pilot schemes in Scotland including Glasgow and Aberdeen.