A 14-year-old boy found dead at his home near Garstang had been struggling with thoughts about death, an inquest heard.
Stephen Mortimer was found in the garden behind his house in Victoria Terrace, Calder Vale, by police on January 4 after being reported missing by his parents Andrew and Caroline.
Stephen suffered from autism and had moved schools shortly before Christmas.
He had been a student at Ripley St Thomas in Lancaster between Years 7 and 9 but did not return to the school after July 2016.
During the first day of a two-day inquest, Lancaster Coroners' Court heard that Stephen was "intelligent and funny" but struggled to express his anxiety and would instead talk about guns and death.
Although he had begun life well at Ripley, during Year 9 his behaviour began to change.
Ripley principal Liz Nicholls told the inquest the school had a specific way of supporting pupils with autism, which included each one having a teaching assistant with them in the majority of lessons.
"Stephen settled in very well in Year 7 and was great to work with," Mrs Nicholls said.
This was despite "serious concerns" raised by his former primary school due to him talking about harming himself and others.
By Year 8 there were reports of Stephen becoming less enthusiastic about school, and he returned to school in Year 9 with a negative attitude.
Stephen was given extra lessons to talk about his concerns but he was reluctant to do so, Mrs Nicholls said.
He was becoming increasingly disturbed in lessons, began talking about killing other people and inappropriate files were found on his school computer history.
Mrs Nicholls told the inquest - led by coroner Richard Taylor - that in January 2016 she stated that Stephen's mental health concerns needed to be dealt with as a matter of urgency.
"He said his mind was in a state of hatred which couldn't be repaired," she said.
Mrs Nicholls recommended that he was referred to Child and Adolescent Mental Health Services (CAMHS) by his GP.
"Stephen found it very hard to talk about his concerns," she said. "We felt we needed some expert help beyond the school."
Mrs Nicholls said Stephen increasingly talked about suicide, told staff he was going to kill them and became less co-operative and more defiant.
He became fascinated by school massacres and would write about them in his journals.
After he told teachers he would bring a gun and knife to school to kill people, it was agreed that his parents would check his bag each morning.
"We were very alarmed by his behaviour," Mrs Nicholls said. "We took him very seriously."
That April the autism teacher in school said Stephen was an "immediate safeguarding issue" due to his obsession with the "dark web".
Following a playground altercation with other pupils last May, which involved Stephen holding a sharp piece of wood, along with a corridor incident on the same day during which Stephen told a teacher he wanted to jump out of the window to kill himself, Stephen was given a five-day exclusion from school.
"We decided a short fixed-term exclusion was the best thing," Mrs Nicholls said. "My first duty as headteacher is to keep the children safe and we were really wondering how we could keep Stephen and other children safe."
Stephen's parents later allowed the school to make a referral to the CAMHS team. It was also decided he could not return to mainstream school until there was more support, so he was put into 'learning support' at Ripley instead, where he remained until the end of the summer term.
Over the summer Stephen's parents informed Ripley their son would not be returning to the school.
Specialist autism consultant Lynn McCann told the inquest Stephen was "intelligent and funny and had lots of interests he liked to talk about."
Mrs McCann, who had worked with Stephen since he moved to Ripley, said Stephen struggled to express his anxiety and would talk about guns and death as a way of doing that.
He also used song lyrics as a way of expressing how he felt and described himself to Mrs McCann as feeling "on the edge."
"He talked a lot about things he seemed to despair of, such as his future and the point of education," she said. "He said he didn't mean it when he said he was going to kill other people. He didn't understand the effect that it might have on them. Part of autism is not understanding other people's thoughts.
"He was really worried about the world and the state of it and would despair at things like the Iraq War."
Mrs McCann said she became concerned about the frequency and intensity of Stephen's outbursts.
"I was concerned about his underlying mental health," she said. "I do believe Stephen was trying to make sense of it all. He did a lot of thinking out loud and he didn't understand the effect that it could have on others."
Mrs McCann said the school tried to find a way for Stephen to cope following his exclusion.
"Going into a classroom was extremely stressful for him," she said. "Putting him back in class at that time wouldn't have dealt with the problem.
"Trying to get the environment right in a busy mainstream high school is very difficult.
"He struggled a lot to cope with emotions. He felt them very clearly and they influenced his thinking a lot. He wasn't able to self-regulate."
Mrs McCann described Stephen as having the emotional development of a teenager with the understanding of a much younger child.
The inquest continues.