Bailey Gwynne, 16, was fatally injured by a stab wound to his heart at Cults Academy, Aberdeen, in October last year.
Witnesses started giving evidence on Tuesday at the High Court in the city, where a youth is accused of murdering the schoolboy.
The 16-year-old, who cannot be named for legal reasons, denies the charge.
Sobs were heard in court as details of the incident on 28 October were given at the start of the trial, which is expected to last up to five days.
Head teacher Anna Muirhead, 57, told the court that on the day of the alleged murder, a staff member came to her office during lunch break and told her there had been a fight and an ambulance had been called.
Ms Muirhead said she left her office and saw Bailey lying on the ground by the reception area, with staff members around him.
As she made her way to see if she could help she saw the teenager, who is now accused of Bailey’s murder, sitting in a reception area with a teacher.
She said: “He was sitting side on to the seat. He was sitting slightly curled up. He was distraught or upset. I questioned what was going on. He indicated ‘that was me, that was my fault’.”
Ms Muirhead told the court: “I knew immediately it was very, very serious.”
She said Bailey was “very pale” and she could see blood.
Crime scene examiner Jason Parker, 31, told the court he recovered a knife from a recycling bin in a communal area of the school.
The knife, encased in a safety container, was passed round the members of the jury.
A witness who saw the fight broke down in tears twice as he was asked about how an argument started between Bailey and the accused.
He said Bailey had some biscuits and another boy wanted one, then Bailey and the accused began name-calling and punching each other.
He said he did not remember who started it, and defence counsel Ian Duguid QC produced a statement which the witness, who cannot be identified, gave to police after the incident.
A passage read to court said: “(The accused) said something like your mum’s fat, then Bailey lashed out at him.
“Bailey grabbed hold of (the accused) and pushed him about. (The accused) started to defend himself and they’ve started grappling.”
Asked by Mr Duguid: “Is this the way it was?,” the witness said: “I think so.”
In today’s evidence he said the accused pulled out a knife or sharp object from a pocket inside his jacket.
He said: “It went into Bailey.”
Computing teacher Alasdair Sharp, 28, said he saw the two engaged in “what looked to be a scuffle”.
The witness said they were grabbing each other and a couple of punches were thrown.
He said: “I asked them what was going on. One of them said ‘he called my mother fat’.”
The teacher led the two along a communal area known as ‘the Street’ towards an office.
Mr Sharp said: “As I got to towards the end of the Street I turned around and I saw Bailey staggering towards the wall.
“(The accused) was a wee bit behind him, was moving towards him looking like he was going to help him.
He said Bailey made it to the wall and he noticed he was very pale.
He told the court: “At this point I noticed the trail of blood going along the Street, where we’d come from.”
Mr Sharp said: “He became very pale and there was a lot of blood coming out of him.
“To begin with he seemed fairly coherent but as events unfolded he began to lose consciousness.”
The jury was read a statement containing facts agreed by prosecutors and the defence.
It said: “The accused became engaged in a fight with Bailey Gwynne... in the course of which Bailey Gwynne was struck on the body with a knife by the accused, thereby causing his death.”
The court heard Bailey suffered a “penetrating wound to the heart” and a post-mortem examination found the cause of death to be the result of a “penetrating stab-force injury to the chest”.
The accused denies murdering Bailey and being in possession of knives or bladed instruments and two knuckledusters at Cults Academy on occasions between August 1 2013 and the day of the alleged murder.
The trial, before Lady Stacey, continues.