DOUGLAS COUNTY, Colo. — A preliminary hearing began Monday for the younger of two students accused of carrying out a deadly May 7 shooting at STEM School Highlands Ranch.

The hearing for Alec McKinney, 16, began at 8:30 a.m. Monday. Defense attorneys for the teen had asked the judge to close the hearing to the public, but the judge denied that request.

He and his co-defendant, 19-year-old Devon Erickson, are each charged with 46 separate counts, including two counts of first-degree murder, one count of conspiracy to commit first-degree murder, 31 counts of attempted first-degree murder, and charges including arson, burglary, theft, weapons possession, criminal mischief, interference with a school and reckless endangerment.

Kendrick Castillo
Kendrick Castillo
Castillo Family Friend

Student Kendrick Castillo was killed in the shooting after he and classmates rushed one of the two gunmen inside the K-12 school located at 8773 S. Ridgeline Blvd. Witnesses and law enforcement have credited Castillo for saving the lives of his classmates. Eight others were also shot.

The judge heard about four hours of court testimony before deciding that the prosecution had provided enough evidence for the case to go to trial. The court, however, still needs to decide whether McKinney will be tried as an adult or juvenile.

RELATED: Judge rules there's enough evidence for older STEM School shooting suspect to stand trial

Detective Brian Pereira with the Douglas County Sheriff's Office was the first witness to testify during the hearing, as prosecutors laid out the evidence in the case.

Pereira detailed the “extensive amount of information,” gathered during interviews with witnesses and suspects in the case, including Snapchat messages between the two suspects and video surveillance from inside the school.

Shortly before the shooting, the detective said McKinney sent a message to his alleged co-conspirator that read, “we have it all planned out.”

Erickson responded with “go now,” under his Snapchat username, “Devonkillz.”

Moments later, shots rang out from inside classroom 107 where a British Literature class of 26 students and two teachers were watching “The Princess Bride.”

One video presented during the hearing shows the suspects inside Erickson’s home the morning before the shooting. In the video, Erickson is seen attempting to break into a locked safe inside the master bedroom of the home as a voice believed to be McKinney yells, “(expletive) open it.” Erickson is then heard saying “I’m trying.”

In another video, Erickson is seen snorting a line of cocaine as a voice, again believed to McKinney, says, “(expletive) do it.”

On the day of the shooting, Pereira said Erickson picked up McKinney and the pair went to his parent’s house. The pair is accused of stealing four weapons from the inside and spray-painting the wall of Erickson’s parents' closet.

The two suspects, according to Pereira, were positioned at different sides of classroom 107, Erickson toward the south door and McKinney at the north entrance. Both are seen on surveillance video entering through the middle school entrance of the school.

Video surveillance from inside the school shows the two suspects slapping hands before going in opposite directions in the school hallway just before the shooting.

Another video from inside the school showed McKinney with a gun pointed to his head moments before a school resource officer was able to take him into handcuffs. Pereira testified that McKinney said he had intended to take his own life, but was unable to maneuver the gun’s safety feature.

RELATED: Affidavit: Security officer shot, wounded student during STEM school attack

Body camera footage showed a magazine, cellphone and multiple bullets that were emptied from McKinney’s pockets after he was apprehended.

McKinney had allegedly told investigators he had been hearing voices since he was 12 years old, and that he took medication to quiet the voices. Pereira said the voices McKinney heard got worse at night, and at one point, told him “this place deserves to be shot up."

Pereira said the two suspects discussed the topic of school shootings “extensively,” including mentions of the 20th anniversary of the Columbine High School shooting.

Erickson told investigators that he “knew a lot about guns,” according to Pereira, and was able to tell investigators the make, model and caliber of the four weapons found inside the classroom. McKinney told investigators he had only used a gun once and that it was years before the shooting, and that Erickson had shown him how to load a gun, Pereira said.

Ultimately, Pereira said that other than the two Snapchat videos of McKinney yelling at Erickson, there was no other evidence to support that McKinney had threatened to kill Erickson if he didn’t help carry out the shooting.

Erickson’s defense attorneys have previously argued that he was not a willing participant in the school shooting and that McKinney threatened to kill him and his friends if he didn’t help.

A judge ruled at a hearing in September that there was enough evidence for the case against the older suspect to go to trial. He continues to be held without bond and is scheduled to appear in court for an arraignment at 1:30 p.m. on Dec. 6.

Right now, despite his age, McKinney is currently charged as an adult.

"What happens in a reverse transfer hearing is that the defense lawyer is going to try to attempt to convince the judge that the case should go back to juvenile court," said 9NEWS legal expert Scott Robinson. "And the judge looks at a lot of factors, including the age and maturity of the juvenile and the nature of the criminal act alleged."

Court proceedings in Douglas County will continue at 8:30 a.m. Tuesday. The defense is expected to call on several witnesses to testify in regard to McKinney’s mental health.

RELATED: Denver brewery unveils beer in honor of Kendrick Castillo

SUGGESTED VIDEOS: Investigations from 9Wants to Know