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.

In the message, McKinney allegedly told him not to come to school. “Please don’t,” Erickson responded, according to a preliminary hearing.

The two suspects are accused of carrying out a mass shooting at STEM School Highlands Ranch near Denver in May, killing Kendrick Ray Castillo, 18, and wounding eight others.

Following the shooting, Erickson told investigators that McKinney made him do it and tasked him with guarding an exit and telling everyone not to move. He said he only fired one shot and surrendered the weapon to the three boys who rushed him, among them Castillo.

But one of the people who rushed him, Brendan Bialy, told investigators that Erickson pointed the guns at the heads of those who rushed him and did not willfully give up his gun, according to Douglas County Sheriff lead investigator Brian Pereira.

Four bullet casings from Erickson’s gun were found at the scene, Pereira said in court.

Snapchat messages

The defense presented audio from a police interview in which McKinney said Erickson is an “idiot” and jumped on the bandwagon easily.

Pereira told the court that on the day of the shooting at 1:47 p.m., McKinney sent a message on Snapchat telling Erickson “we have it all planned out”

At 1:51 p.m., Erickson messaged back, “go now”

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.

Devon Erickson

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.