Nothing that I can say, nor any sentence I may impose, will do anything to lessen the grief that Bailey Gwynne's family and his friends feel. The shock of his death at such a young age was felt in the wider community and nothing I say will alleviate that.

You were convicted by the jury of carrying a knife and carrying knuckledusters in school, and of culpable homicide of Bailey Gwynne. I have to sentence you in respect of these crimes.

I have been assisted by all that [defence lawyer] Mr Duguid has said on your behalf and by the report prepared by the social worker. I have taken careful account of all that has been said.

I accept, as submitted on your behalf, that you have no previous convictions nor is there any record of violence. I have also borne in mind your age and immaturity. Because you are 16 years of age I have to take account, as one of the primary considerations in deciding on sentence, your welfare and the desirability of you being reintegrated into society.

I also have considered the need for punishment and deterrence of others. The safety of the public is a further primary consideration. Taking all of the circumstances into account, I have come to the conclusion that the only suitable disposal is a period of custody.

Parliament has made the carrying of weapons in public places an offence punishable by custody because of the danger that is created as soon as anyone carries a knife or another weapon.

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

You took them to school on several occasions. I wish to make clear to you and anyone else who is ever tempted to carry a knife that the courts will regard that as a very serious matter.

It is obvious that buying the knife and taking it to school is what started the terrible course of events that led to Bailey losing his life. If you had not carried a knife, the exchange of insults between you and Bailey would have led at the worst to a fist fight in which there would probably have been no serious injury and almost certainly no loss of life.

In order to mark the serious nature of the offences in charges one and two, that is the charges of carrying the knife and the knuckle dusters, I sentence you to a period of detention of one year on each charge, to be served concurrently to each other. You will serve those sentences before the sentence I must impose on the charge of culpable homicide begins.

The charge you faced was murder. You have always accepted that you killed Bailey Gwynne, and you offered at an early stage to plead to the serious crime of culpable homicide. Having heard all of the evidence the jury convicted you of that crime.

The evidence showed that there was an exchange of insulting words and that a fight between you and Bailey had just begun. You then took the knife from your blazer pocket, opened the blade, and used it to stab him in the chest.

A school teacher arrived and broke up the fight. He did not see the knife and did not know it had been used. When Bailey started to collapse you did shout to the teacher to get his attention. You also disposed of the knife in a bin, but you were frank to the deputy head teacher and soon after wards to the police about what you had done.

The wound you caused was fatal and despite the best efforts of first aiders paramedics and doctors Bailey's life could not be saved.

The report tells me that you have shown significant regret at what you have done. You have shown understanding of the loss you have caused and the impact that your actions have had for ever on other people. You have passed some of your exams at school and have worked in a part time job. In spite of that you have shown that you were prepared to buy and carry a weapon and then to use it.

The social worker is of the opinion that those actions show that you are a risk to the safety of others. I agree with him. The social worker recommends that you undertake focussed support and intervention aimed at understanding factors contributing to the crime you have committed and reducing the risk of future violence. I agree with him that such work is needed and I also believe that after your release from custody you will need supervision.

I have decided that an extended sentence is the only appropriate disposal, taking into account all of the circumstances including your age. I hope that will lead to you being both punished and helped towards rehabilitation while you are detained in a structured environment. Following your release you will be supervised to maximise the chance of your successful reintegration into society.

I am required to take into account the fact that you offered a plea of guilty to culpable homicide at an early stage. There was clear evidence of your having killed Bailey. You never denied that.

In the exercise of discretion which I have under the law, I am going to reduce the custodial part of the extended sentence from ten years to eight years. The period of supervision will be for two years, which makes a total extended sentence of ten years.

You will be detained at such place and under such conditions as Scottish Ministers think fit. I have to tell you that if you breach any terms of the licence on which you are released during the period of supervision you may be returned to custody.

The sentences of one year on each of charges one and two will be backdated to October 28. They are concurrent with each other. The extended sentence is consecutive to them.