A YEAR 11 student penned a graphic story about a high school massacre for his English class just a month before he stabbed a fellow student at his own Brisbane school, a court has heard.

The Brisbane Supreme Court was told the 16-year-old student, who will be released next May, had fantasised for years about creating his own horrific bloodbath, which he attempted to replicate by launching a frenzied knife attack on a 14-year female student in May last year.

The court was told the boy, who cannot be named, stabbed the Year 8 student, at least a "dozen times'' as she applied make-up in a toilet block at the school shortly after 7am.

Prosecutor Michael Lehane said the troubled teenager walked on to school grounds armed with three knives and a hammer with the intention of killing as many of his schoolmates as he could before taking his own life.

The boy, now aged 17 but sentenced under the Queensland Juvenile Justice Act 1992, was sentenced to four years in youth detention after pleading guilty to one count of attempted murder.

Justice John Bryne, who described the teen's behaviour as a worrying and terrifying indiscriminate act with no real motive, ordered the former student be released after serving two years' detention.

The ruling means the boy, who has been in pre-sentence custody for more than 14-months, will be released back into the community in May next year.

Justice Byrne said it was extremely disturbing that during the attack the boy dragged his "small, young'' victim back into the toilets as she tried to flee in a bid to "finish her off'' before killing others.

"This is terrifying. That someone (like you) would take weapons to school and attack (people) indiscriminately for no (apparent) reason.

"You have (now) shown what you are capable of.''

Mr Lehane tendered a pre-sentence report to the court which revealed, in part, the boy's obsession with staging a school massacre, killing a neighbour's dog and watching "snuff movies'': films available online showing real-life executions.

He said on the day of the attack the boy, wearing black sunglasses, was seen pacing outside the girls toilets before charging in and repeatedly stabbing the young girl about the head, neck, body, arms and hands, as she was getting ready for cross-country training.

The court was told the girl's blood curdling screams could be heard by other students, including one who heard her yell: "What are you doing? Somebody help me, please.''

Mr Lehane said the girl broke free from her attacker, only to have him drag her back and plunge a knife into her a total of 12 times.

He said the girl's head and body was soaked and dripping with blood when a fellow student yelled out and the attacker dropped his knife and fled.

The court was told the boy - who was filmed running away by CCTV cameras at a nearby railway station - simply walked into a local police station about two hours after the attack as if nothing had happened and surrendered to stunned officers.

Mr Lehane said the ensuing police investigation revealed the boy had submitted a short story as part of an English assignment in which a teenager ''massacres his own peers in a rampage and kills himself'' a month or two before the attack.

He said the boy also tried to execute a plan to kill a neighbour's dog on a night his parents went out for dinner, but gave up when he could not find the much-loved family pet in the dark.

The court was told he had also visited a cinema armed with knives on another day.

Barrister Mark Johnson, for the boy, said his client was an otherwise good and intelligent child, with very good parents who saw no signs of the son's obsession for murder and violence.

He said the boy's behaviour seems to have been triggered by severe anxiety.

The court was told some of the anxiety related to the fact he had failed to be picked in one his school's "first 15'' sports teams.

Mr Lehane said the girl was taken to hospital for treatment with multiple stab wounds.

It is understood, although it was not revealed in court, that the girl has made a full physical recovery.

However, the court was told she still suffered the emotional and psychological scars caused as a result of the terrifying attack by a boy she "hardly knew.''

The frail, small boy, dressed in long black trousers and white shirt, sat meekly during the hearing as his anxious parents sat less than 2m away.

A NOTE ABOUT RELEVANT ADVERTISING: We collect information about the content (including ads) you use across this site and use it to make both advertising and content more relevant to you on our network and other sites.