Two mini prisons for women are to be opened by 2020, the Scottish government has announced.
The community custody units will be built in Glasgow's Maryhill district and Dundee, and will each hold 20 low risk offenders.
The justice secretary said the units would aid rehabilitation by holding prisoners closer to their homes.
The move is part of a wider plan to change the way women are treated by the criminal justice system.
That includes the demolition of Scotland's national female prison, HMP Cornton Vale in Stirlingshire.
'Bricks and mortar'
The Scottish Prison Service is developing plans for a smaller prison for about 80 women at the site.
Justice Secretary Michael Matheson told Holyrood that there was an increasing shift in favour of community sentences.
He said that was why the Scottish government wanted a presumption against prison sentences of 12 months or less.
"There will always be cases where the court rightly takes the view that a prison sentence is absolutely justified, but for those who do end up in custody, we must think beyond bricks and mortar," he said.
"Over the past decade this government has taken steps to end our reliance on custody and move towards effective community sentences that enhance public safety and promote rehabilitation, and which evidence shows are more effective at reducing reoffending and thus reducing the risk of further victims."
Colin McConnell, chief executive of the Scottish Prison Service, said he wanted the units to be a real part of the communities they are located in.
He added: "Getting it right for those in custody is a key step in ensuring the safety of the entire community. By successfully reintegrating offenders we reduce risk and create safer communities."
The announcement follows the decision in 2015 not to proceed with the planned construction of a large women's prison in Inverclyde.
About 110 prisoners were transferred from Cornton Vale in Stirling to HMP Polmont, near Falkirk, in August last year.