The teenager accused of murdering Bailey Gwynne told police he did not mean to stab him and had tried to save his life.
The comments were made during the trial of a youth, who cannot be named for legal reasons, who is accused of murdering 16-year-old Bailey on October 28 last year.
The youth denies the allegations.
The High Court in Aberdeen watched a recording of a police interview with the accused carried out by Dc Elinor Bosanquet and Dc David Runcie the day after Bailey’s death.
During the interview the youth said he had a knife as he was “trying to act cool and tough”.
The accused said the incident began after Bailey made a remark about someone’s weight as the person was eating a biscuit.
The accused said: “I said just like your mum.”
He said Bailey looked “angry”, and that he opened the knife to “scare him away”.
He said: “He got in the way, and it stabbed him.”
During the interview the accused said: “I did not mean to, but I stabbed him.”
When asked what he thought Bailey was going to do, the accused told Dc Runcie that he thought he was going to punch him.
He said: “I saw him with a clenched fist, I was trying to scare him away, I did not realise he was that close. I took out the knife to scare him away, I was not going to stab him.”
He said once the fight had been stopped he noticed that Bailey was bleeding.
He said: “I said ‘he is bleeding’, he was bleeding pretty bad.”
He went on to say that he tried to help stop the bleeding.
The accused went on to say in the interview: “I was just saying, ‘He is going to die’. At that point I burst out crying with my head in my hands.”
He went on to say how he had texted family members and said he loved them and that he was “going to prison”.
The recording also showed that when the youth was told he was being charged with murder, he said: “I’m being charged with murder?”.
He then started to cry and said: “I did try to save him.”