All under-18s have now been removed from Scotland's young offenders institutions and transferred to more child-friendly settings.
The change follows suicides of young people while detained and the passage of a new law that bans children being sent to prison.
As recently as July, there were still nine 16 and 17-year olds still held in custody at Polmont Young Offenders Institution (YOI) near Falkirk, but the final child was moved to a secure children's care unit on Friday.
The Scottish Prison Service said it was a "landmark day with children no longer admitted into our care".
BBC Scotland News understands the change will free up about 70 places in the prison system.
In recent years, two under-18s are believed to have taken their lives at Polmont.
William Brown, also known as William Lindsay, was 16 when he died in 2018 while in July 17-year-old Jonathan Beadle is understood to have died by suicide.
Scotland's chief inspector of prisons, Wendy Sinclair-Gieben, has previously said sending 16 and 17-year-olds to facilities such as Polmont - especially those who had not yet been convicted - was a breach of their human rights.
The Scottish government promised in March 2022 to end the practice and the Children (Care and Justice) (Scotland) Bill received Royal Assent this summer.
Minister for children and young people Natalie Don-Innes said the government had been moving "at pace" to implement the new law.
"This move will ensure children in conflict with the law are placed in safe suitable accommodation which will ensure their wellbeing and rehabilitation is at the heart of their care, while also keeping communities safe," she said.
Campaigners have welcomed the move which they say should lead to better outcomes for young people.
Fiona Dyer, director of the Children and Young People’s Centre for Justice, told BBC Scotland News that prison environments could be "detrimental" and "traumatising" for young people.
She said: “Many children who are 16 and 17 and are in conflict with the law, are some of the children who are placed in the most vulnerable situations, who have backgrounds that are characterised with trauma and we are retraumatising them by putting them in environments that are not designed for children.
"We should be so proud in Scotland that we are taking this child-centred approached and leading the way to our neighbouring countries."
There are currently four secure care centres in Scotland, each of which houses young people in groups of up to six.
The centres are overseen by the care inspectorate and run by care staff who work with the young people.
Ms Dyer added: “As well as getting their behaviour addressed they are also getting the care and nurture that children need to thrive."
The death of Jonathan Beadle at Polmont in July, understood to be by suicide, was the second such death of a teenager at the site in six years.
The 17-year-old was sent to the prison after pleading guilty to a charge of acting in a disorderly manner and being in possession of weapons with intent to "assault and murder" a 16-year-old girl.
A joint fatal accident inquiry was held earlier this year into the deaths of Katie Allan, 21, and William Brown, 16, who both took their own lives at Polmont within months of each other in 2018.
William, also known as William Lindsay, had never been convicted of a crime and was only been sent to Polmont because a place could not be found for him in a secure children's unit.
William's legacy
Niall Cahill, a project worker who knew William, said the change in the law was "fantastic news".
"Regardless of what somebody has done at that age they at least deserve the chance to be cared for," he told BBC Scotland News.
"They are children at the end of the day and everybody needs that at one point in their life, that little bit of care or somebody that shows they care."
The youth worker described William as a "charismatic, funny boy, who was so full of life".
William spent most of his life in the care system, being moved between 23 placements including homes and secure units, in 15 years.
"Throughout that he kept an energy, kept a friendliness and a fun-ness about him probably to cover up quite a bit of pain because that was there too," he said.
He added: "I hope that lasts as William’s legacy in this. It breaks my heart to think that William would just be forgotten in all of this because you have got to learn lessons from such a catastrophic mistake."