A vulnerable teenager who fired gunshots at a classroom, sparking fears of Australia's first US-style school shooting, will spend at least 16 months in detention.
The 15-year-old boy, who cannot be named for legal reasons, took two rifles to his school, the Atlantis Beach Baptist College in Two Rocks, about 70km north of Perth, on May 24 last year.
He fired three shots from his father's .243 hunting rifle, sending students and teachers scrambling for cover as two bullets hit a classroom and another a grassed area near a playground.
No one was physically injured and the teen was arrested at the scene after calling triple zero and admitting what he had done, the Perth Children's Court heard on Thursday.
He later pleaded guilty to eight charges, including two counts of unlawfully acting with intent to harm and endangering the lives of students and teachers.
Court President Hylton Quail said during sentencing that it was an extremely serious and wicked incident.
"Fortunately no one was shot," he said.
"Good luck prevented a tragic outcome."
Judge Quail said the teen's actions caused fear, anxiety and distress for the teachers and students.
"The offending caused the blood of every student and parent, indeed I suspect every person in West Australia who heard about it, to run cold," he said.
"One teacher said she had never been so scared in all her life.
"All will remember this day for a very long time."
Judge Quail said the boy was intelligent and from a good home and his parents were shocked by his behaviour.
He also said the teen had "abandoned" his initial plan to kill people before he "pulled the trigger" and accepted he was very sorry for his actions.
Judge Quail sentenced the boy to three years in detention, with at least 16 months to be served before he is eligible for release.
The court heard that during the call to triple zero, the boy told the operator he had initially intended to kill people and himself but didn't follow through with it to protect his siblings.
The incident plunged the school into lockdown amid reports a gunman dressed in black was aiming his weapon at students in the playground.
One student lay on the ground and attempted to use a backpack as cover, causing a teacher to fear he had been shot.
Others ran into classrooms and hid under tables and in cupboards and storerooms.
The boy, who was diagnosed with autism spectrum disorder and was suffering a depressive episode at the time, started planning the shooting months earlier after being bullied and targeted by gossip.
The court heard he made dozens of internet searches for information about school shootings, massacres and the age of criminal responsibility.
Four days before he pulled the trigger, the teen "talked a lot about mass shootings in the US" during a discussion with a friend.
He told another the night before the incident to stay home the following day because he was going to shoot the college. Neither took him seriously.
The next morning he unlocked his dad's gun safe and removed two rifles before driving his father’s four-wheel-drive to the school.
Judge Quail previously said there was no legal record of a school shooting in Australia before the boy's offending.
Lifeline 13 11 14
Kids Helpline 1800 55 1800 (for people aged 5 to 25)