A teenager has been locked up for nine years for stabbing a school pupil to death during a "trivial" row.

Bailey Gwynne, 16, died from a knife wound to the chest at Cults Academy in Aberdeen on October 28 last year.

A 16-year-old youth, who cannot be named for legal reasons, was convicted of culpable homicide last month after a jury at the High Court in Aberdeen ruled against a charge of murder following a five-day trial.

He was also found guilty of two other charges of having a knife and knuckledusters at the school.

At the High Court in Edinburgh on Friday, judge Lady Stacey ordered the killer to be detained for nine years.

Passing sentence, Lady Stacey told the teenager: "If you had not carried a knife, the exchange of insults between you and Bailey Gwynne would have led at worst to a fist fight ... and certainly not loss of life."

The judge also told him: "Nothing that I can say nor any sentence that I impose will do anything to lessen the grief that Bailey Gwynne's family and friends feel.

"The shock of the death at such a young age was felt in the wider community; nothing I can say or do can alleviate that."

The judge's sentence means the killer will serve nine years in custody - eight for culpable homicide and one for carrying weapons. He will then be supervised for a further two years on release.

The youth admitted fatally stabbing Bailey but had denied murder.

A jury at the High Court in Aberdeen took less than two hours to convict him of the lesser charge of culpable homicide last month.

During evidence, it emerged that Bailey - a hard-working fifth year pupil with four young brothers - suffered a major loss of blood after receiving the single stab wound to the heart.

The court heard that on the day he was stabbed, Bailey had missed out on a lunchtime trip to the local supermarket as his friends forgot to tell him about the plan.

He was in a corridor with a group of boys and, after refusing a second biscuit to one, made a remark about him getting fatter.

Accounts of the fight differed between witnesses but the jury heard that Bailey, who was on his way out of the corridor, turned round and squared up to the youth after he made a comment about his mother.

They both were said to have thrown punches and two onlookers said Bailey had him in a headlock before he pulled out a knife.

A post-mortem examination revealed he died as a result of a ''penetrating stab-force injury to the chest'' which went directly into the heart.

The killer told police as he was handcuffed ''it was just a moment of anger''.

He later told officers: ''I didn't mean to but I stabbed him.''

In his speech to the jury, prosecutor Alex Prentice QC described the row as a "silly, trivial fight between two school boys'', but added: "Bailey Gwynne had no chance."

Defence QC Ian Duguid said the case centred around an incident which happened "in the blink of an eye'' within 30 seconds.

The court heard the youth has no record of violent offending and the judge said she had taken this into account, along with his young age, when deciding his sentence.

But Lady Stacey said a social work report had deemed him a risk to others and she agreed.

She told him: "You have shown that you were prepared to buy and receive a weapon, and then use it."

For the two charges of carrying knives and knuckledusters at Cults Academy he received one year each in custody, to run concurrently.

He was given an extended sentence of eight years in custody and two years' supervision for culpable homicide.

Lady Stacey said: "You chose to buy weapons online so that you would not be asked for proof of age and you arranged to have them delivered in such a way so your mother would not know about them."

Before sentencing, the judge heard the youth realised the impact of what he had done and was being treated for symptoms of post traumatic stress disorder including nightmares, anxiety and depression.

His lawyer Ian Duguid QC said: "He genuinely is affected by these events in quite a profound way.

"He genuinely recognises that he has taken someone's life and he feels very profoundly sorry about that."

Mr Duguid said the "naive" youth who thought it would make him look cool to carry a knife would have to live with the "flawed" decision for the rest of his life.

He said: "This case has tragedy written right over it."