After he revealed that he had forgiven his attacker, the 50-year-old supply teacher - known to his pupils as Mr U - went on: “It was however important for the law to run its course and for a strong message to be sent out, especially to kids of similar tendencies, that violence is not acceptable.

“Our prayer for him is that he will make use of the opportunities and support that will be provided to him to become a changed person who will make a positive contribution to the society.”

Jonathan Sharp, principal crown advocate for the CPS in Yorkshire and Humberside, said outside Bradford Crown court: “This was a truly shocking incident: a pre-planned attack by a 14-year-old youth on his teacher, in front of the rest of the class.

“Mr Uzomah was stabbed deeply in the stomach, with a knife that the youth had brought into the school specifically for that purpose.

“It also seems that the attack was at least in part racially motivated - the youth used a highly offensive racist word just before stabbing his teacher.

“The victim has suffered serious physical and psychological injuries, has had to put his career plans on hold and is uncertain when, or if, he will feel able to return to teaching - a profession he loved.

“It was also shocking and profoundly distressing to Mr Uzomah that the youth posted a Facebook update boasting of what he had done. This subsequently received 69 ‘likes’ from the youth’s circle of acquaintances.

“In the circumstances, it is remarkable that Mr Uzomah has expressed his desire to forgive the victim, whilst wishing to see justice done as a deterrent to others. I hope that the sentence passed today gives Mr Uzomah and his family some comfort. Our thoughts remain with them.”

Police outside Dixons Kings Academy in Bradford.

Speaking outside court, Detective Superintendent Simon Atkinson, of West Yorkshire Police, described the attack as “shocking and very serious” and said the teenager showed no concern for Mr Uzomah by fleeing the scene.

He added: “He worryingly showed a further lack of remorse towards his victim by boasting about his actions on social media.”

Mr Atkinson said he hoped the sentence would give some closure to Mr Uzomah who he described as being “incredibly magnanimous towards his attacker”.