A student often took a gun to school in Maryland as a defence against a potential shooting, according to court documents.
Alwin Chen allegedly took the Glock semi-automatic handgun to Clarksburg High School and could also gain access to the guns owned by his father.
It is claimed Chen usually kept the gun in a holster or inside his bag, before he was arrested on February 15, according to Daily News.
He was detained by police after another student informed a member of staff about the gun, which they believed he'd been bringing into the school since December.
According to the prosecution, the student told police the suspect regularly spoke about "how he would kill anyone" as well as taking weapons into the school.
However Chen also wrote about mental illness and loneliness in a diary, according to the prosecution.
The 18-year-old allegedly wrote that he sometimes wondered if he was "crazy or mentally ill", but he wouldn't admit it "because I know how to cope and blend into society but it’s just too lonely.”
It is claimed he added: “I want to kill all evil forces, but I’d like to die for nothing.”
His defence claims the student was not a threat and pointed out weapons have been taken away from his home. Officials from the school also agreed that he did not carry the weapon to intentionally harm others.
The student is still detained by police and is expected to appear at a hearing on Thursday (March 1).