A 14-year-old boy, who cannot be named for legal reasons, is accused of stabbing two students at Kingsbury High School in northwest London in February, a court heard.
The teenager allegedly launched the attack to seek revenge on pupils who had caused him to be suspended.
Jurors at the Old Bailey were told that the boy had been excluded from Kingsbury High School five months prior to the alleged stabbing spree. He is accused of targeting one student in what was described as an "unprovoked attack" while shouting "Afghanistan forever."
A witness, giving evidence in court, stated that the boy came "for revenge on a lot of people that got him suspended."
Prosecutors allege the boy was motivated by "extremist ideologies" and carried out the attack "as an attack of terrorism."
One victim, identified as "Child A," sustained four stab wounds to the neck and head. In a pre-recorded interview played in court, the witness recounted that Child A appeared to be in shock and did not cry or scream, stating, "I think he was in shock, he didn’t know how to react."
The witness described running to help the victim, applying pressure to the wounds and saying, "I have seen this on videos and stuff, you need to stop the bleeding."
He told officers, "I think he just accepted he was going to die," adding that the child had said, "I can’t breathe, I can’t breathe."
Recounting the assault, the witness said the assailant shouted "Allahu Akbar" twice as he struck Child A on the neck with the first blow, before stabbing him three more times. "His first stab was really carefully to the neck but the rest were just random stabs," the witness told the court.
He suspected Child A was a "side target" and that the attacker intended to go after another pupil who had "made fun of [his] friend’s condition."
Last week, the court heard that the accused accessed extremist video clips on TikTok in the days leading up to the stabbing. Concerns had previously been raised by Kingsbury staff regarding comments the boy made about a recent trip to Afghanistan, where he has family.
"He told [the teacher] that he had spent time with members of the Taliban whilst he was in Afghanistan on holiday, commenting that the Taliban was unfairly portrayed in the West and saying that he knew members of the Taliban and that they were not bad," a prosecutor told the court.
The prosecutor stated the boy arrived at his former school armed with a knife, believed to have been taken from his home. He allegedly used insect spray on a pupil's face to gain entry to a classroom after knocking 15 times.
When the door was answered by a child, "the defendant sprayed that child in the face with the insect spray, allowing him to gain access into the classroom," the prosecutor added.
The suspect, who has since turned 14, denies two counts of attempted murder. The trial is ongoing.