Victims of crime will be given greater consideration by prosecutors in decisions to oppose bail, following a review by the Crown Office.
New guidelines will shift focus to public protection as well as managing risks such as an accused absconding or failing to turn up at court.
Lesley Thomson QC, Solicitor General for Scotland, who commissioned the review, said: "The prosecution service has a responsibility to protect communities from persistent and dangerous offenders.
"Our new bail guidance will ensure that our decisions to oppose bail and have an accused remanded in custody continue to be fair, considered and consistent across the country.
"We cannot predict or prevent offences being committed but can oppose bail wherever there is a potential risk to victims, witnesses and the public at large."
The new guidance is in a confidential "bail manual" prepared by the Crown after the review in May. Public protection and personal safety is the "paramount" consideration, the Crown said.
Other key principles include offences that impact communities, such as drug offences, the likelihood of reoffending and the likelihood of absconding.
The guidance was prepared with help from the police, Scottish Government and victims' groups including Rape Crisis, Scottish Women's Aid and Victim Support Scotland.
David Sinclair, head of communications for Victim Support Scotland, said: "We welcome the refocusing of the prosecution service and the greater protection that will offer communities and victims and witnesses of crime.
"We anticipate dealing with more than 300,000 referrals from victims and witnesses in the next year, and it is important that they feel that their interests are paramount when bail is being opposed, and indeed in cases where bail is granted."