(CNN) - A high school student accused of opening fire in a Colorado school told investigators he targeted those who mocked his gender identity, and had messaged a second suspect on Snapchat hours earlier about his plan, court documents show.
The May shooting at STEM School Highlands Ranch near Denver killed Kendrick Ray Castillo, 18, and left eight others wounded.
In police records unsealed Thursday, Alec McKinney, 16, said he decided to carry out the shooting after the social media message to Devon Erickson,18, the night before.
In an interview with police, McKinney told officials while he made the decision hours earlier, he had been planning the shooting for weeks.
They allegedly broke firearms safe using an ax
McKinney said he was born a female but was transitioning to male, and he targeted specific students who called him "disgusting" for undergoing that process, according to a probable cause affidavit. His attorneys have said he identifies as male.
Erickson's parents owned a safe with firearms, the affidavit says, and the pair left school that day and opened it with an ax.
Erickson took the two handguns used in the shooting from his parents, according to a law enforcement source. Both guns were purchased legally.
Both suspects face criminal charges in the shooting, including first-degree murder, the Denver Post reported. It said McKinney has been charged as an adult.
Suspects allegedly used cocaine
Erickson said they used cocaine in his basement before going back to school. The two students used the middle school entrance because they knew they would be able to get the guns into the school, the affidavit states.
Erickson said McKinney threatened to shoot him if he didn't go along with the plan, documents allege.
After Erickson pulled the magnetic strip on the door and pulled it shut so it couldn't be opened from the outside, they both pulled out their guns and said "nobody move," the affidavit says.
Both teens were detained.
Other students helped disarm the suspects
Brendan Bialy, who helped disarm one of the suspects, said he wants people to remember Castillo as a "legend."
The two were sitting by a classroom door when gunshots rang out.
"It was immediate, nonhesitation, immediate jump into action," Bialy said of Castillo's reaction.
Bialy and a third student joined in and wrestled with the shooter.
Once he got the gun away and the other student had the shooter pinned down, they realized Castillo was unresponsive.
The community had just marked the 20th anniversary of the Columbine High School shooting. The massacre in nearby Littleton killed a dozen students and a teacher.
CNN's Sara Weisfeldt and Sheena Jones contributed to this report.
The-CNN-Wire ™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.