Pupils who are excluded from school aged 12 are four times as likely as other children to be jailed as adults, according to a new study.
Researchers found that boys, children living in single-parent families and those from the poorest communities were most likely to be expelled.
The study also compared the outcomes of youngsters who had been referred to the children`s hearing system by 12 with a closely-matched group of young people involved in equally serious levels of offending who had not been referred.
The team found that those who had been referred were about five times more likely to end up in prison by the age of 24.
More than 4,000 people who started secondary school in 1998 were tracked during the Edinburgh Study of Youth Transitions and Crime conducted by the University of Edinburgh.
According to researchers, equally badly-behaved pupils from more affluent areas and those from two-parent families were shown greater tolerance, and as a consequence were far less likely to be barred from school.
They conclude that early intervention in the lives of children identified as presenting "the greatest risk" does not necessarily reduce offending, but may well groom young people for later imprisonment.
Professor Lesley McAra, head of the university's School of Law and co-director of the study, said: "In practice, the criminal justice system serves to punish poverty, the socially marginalised and vulnerable individuals, as much as those who steal, assault or murder.
"For youngsters who come to the attention of formal agencies at an early age, we need to ensure that intervention does not label and stigmatise."
Professor Susan McVie, co-director of the study, said: "The study findings show that one of the keys to tackling Scotland's high imprisonment rates is to tackle school exclusion.
"If we could find more imaginative ways of retaining the most challenging children in mainstream education, and ensuring that school is a positive experience for all Scotland's young people, this would be a major step forward."
She added: "Exclusion doesn`t solve the problem, it might be a short-term solution for the school but it doesn`t deal with the problem for the child.
"They very quickly become disillusioned with school and education.
"For most of these children, education is the route out.
"We need to find a way to keep children in school and engaged with school, such as a vocational outlet - that is just one route."
The Edinburgh study has been funded by grants from the Economic and Social Research Council, the Nuffield Foundation and the Scottish Government.