DOUGLAS COUNTY, Colo. — The judge heard two different narratives about what motivated the older of the two suspects in the deadly STEM School Highlands Ranch shooting during the first day of what’s scheduled to be a three-day preliminary hearing.

The private defense attorneys representing Devon Erickson, 19, said his then-16-year-old codefendant Alec McKinney forced him to steal guns from his parent’s home, snort cocaine, and then bring the weapons to room 107 of their K-12 charter school, where an English literature class was watching “The Princess Bride.”

One student, Kendrick Castillo, was fatally shot when he and two other students charged at Erickson, who investigators said he claimed to have accidentally hit the trigger, according to testimony from Douglas County Sheriff’s Office Det. Brian Pereira. Eight other students were also wounded during the attack.

During cross-examination, Erickson’s attorneys emphasized statements the teenager made to investigators alleging that he did not intend to hurt anyone, and that McKenney threatened to retaliate if he didn’t participate.

RELATED: DougCo receives 34 applications for $10M school safety fund

RELATED: Brewer sells pint glasses to raise money for STEM School shooting hero

During direct examination, the prosecution asked Pereira to emphasize discrepancies in the story Erickson told investigators – as well as the fact he went to the nurse’s office alone in the moments before the shooting, but didn’t seek out an adult or tell anyone what was about to happen.

The purpose of the preliminary hearing – which began Tuesday – is for the prosecution to prove it has enough evidence for the case to proceed to a jury trial.

Both of the suspected shooters face 46 separate counts for their role in the May 7 attack, 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.

During cross-examination, Attorney Julia Stancil told Judge Theresa Slade she was trying to prove Erickson did not intend to kill anyone the day of the shooting, it was not pre-meditated, and there was no extra malice.

Pereira was on the witness stand for the entire day Tuesday. He is the lead investigator on the case, and spoke to Erickson the day of the shooting and the day after.

Castillo’s parents were in the front row of the packed courtroom. They said they were there to support their son’s memory after what has already been the worst day of their lives.

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

RELATED: Coroner releases autopsy report for STEM School shooting victim Kendrick Castillo

During his testimony, Pereira said investigators obtained Snapchat messages exchanged between the two suspects dating back a year. Erickson used the username “Devonkillz” and McKinney used “jm_moocow,” according to Pereira.

“The nature of the conversations were two high school students who appear to be good friends,” Pereira said.

But, the night of May 6, Pereira testified McKinney sent Erickson a Snapchat message that told him not to go to school the next day. Pereira said Erickson responded with a message that read “please don’t.”

The next day, Erickson picked up McKinney and the two went to his parent’s house, according to Pereira. Pereira said during an interview with investigators, McKinney claimed he knew there were guns in a safe in the house, and that he would steal them with or without Erickson’s help. Pereira said he told investigators he thought Erickson would do what he said.

“What are you going to do, call the cops on your best friend?” the younger suspect is heard saying in an interview with police played in open court.  

According to Pereira, the two suspects said McKinney ransacked the home in search of keys to the safe before he grabbed an ax from the garage. In a Snapchat video shown in court, Erickson is seen trying to pry open the safe with a crowbar.

During direct examination, the prosecution emphasized the fact McKinney was holding the camera and does not appear to be threatening Erickson with an ax like he claimed to investigators. But, during cross-examination, Pereira testified that McKinney’s voice was elevated as he told his friend “just [expletive] open it.” In a photo shown by the prosecution, graffiti that read “the voices win” was painted on the wall of the closet after the pair obtained the guns.

In another Snapchat video shown in court, Erickson was seen snorting a line of cocaine, while McKinney holds the camera and yells for him to do it. During direct examination, Pereira said Erickson claimed he was coerced into using the drug.

Videos shown from inside the school show the two suspects walking inside with a guitar case that investigators would later say held the guns used in the attack. Pereira said Erickson went into room 107 and then left when a teacher told him he looked sick and had another student accompany him to the nurse’s office.

Additional surveillance video shown in court showed Erickson walking to the nurse’s office. Pereira said this was near the administrative building, and while there were opportunities to speak to adults, the then-18-year-old didn’t. He did spend a lot of time in the bathroom, where he texted a close friend, according to Pereira.

At one point, Pereira testified, he received a message from McKinney that said in part “I’m not doing this alone.”

RELATED: 'We need to be more like him': Kendrick Castillo remembered as selfless, tenacious at celebration of life service

RELATED: 1 student killed, 8 others injured when classmates open fire at STEM School Highlands Ranch

Just before the attack, according to Pereira, McKinney sent Erickson a message that read “we have it all planned out.” At 1:51 p.m. on May 7, Erickson sent a message that said “go now,” according to Pereira.

Next, Pereira said, Castillo let Erickson back into the classroom through a locked door. He removed a Glock from the guitar case, according to Pereira, and McKinney entered from the other door.

According to Pereira, multiple witnesses said Erickson yelled for everyone to stay still. In that split second, Castillo leaped up and tackled his classmate.

He has since been credited by multiple witnesses for saving lives. Two other students and a private security guard helped restrain the two suspects in the moments following the attack.

The preliminary hearing is expected to continue with a second law enforcement witness on Wednesday. It is scheduled to last through Thursday.

SUGGESTED VIDEOS | Local stories from 9NEWS