A young robber has escaped a punitive sentence after he satisfied a judge that he had learned to read and write.
Such enlightened sentences are likely to become more common in Spain following the introduction of a Children's Act that promotes innovative treatment of child delinquents.
Judges are being encouraged to make use of new measures such as requiring children to attend school or training courses.
The boy of 15 had been persuaded by an adult and another habitual offender to join them in the robbery of a food store in Granada.
But juge Emilio Calatayud said the boy was "a victim of society": "One cannot punish someone who has never had the most basic education," he said.
The judge agreed with the boy that he would attend a bricklaying course in the mornings and a basic skills course in the afternoon.
After six months' studying, the youth appeared nervous when he successfully read a story and did sums in front of the judge this week.
His teacher told the court that the boy had become particularly interested in reading and was determined to continue studying in the future.