CASTLE ROCK, Colo. — A Colorado teenager charged in a school shooting that killed one of his classmates was pressured into participating by a fellow student with a grudge who had recently befriended him, his lawyer said Tuesday.

The claim came during a hearing to determine whether Devon Erickson, 19, will stand trial for the May 7 shooting at STEM School Highlands Ranch in suburban Denver.

After co-defendant Alec McKinney, 16, insisted he was going to carry out the attack, Erickson went to the school nurse in a failed attempt to avoid it, but McKinney threatened to go ahead anyway and kill his friends and also threatened to hurt him, defense lawyer Julia Stancil said.

Erickson sat next to his lawyers and watched closely as Douglas County Sheriff's Detective Brian Pereira testified at the start of the three-day hearing that revealed some new details surrounding the shooting.

Erickson and McKinney are charged with murder and attempted murder in the shooting that killed Kendrick Castillo, 18, and injured eight others. They have not entered pleas to the charges.

COLUMBINE SHOOTING 20TH ANNIVERSARY: SURVIVORS REFLECT ON HOW MASSACRE CHANGED THEIR LIVES FOREVER

Devon Erickson making a court appearance at the Douglas County Courthouse in Castle Rock, Colo., this past May. (Joe Amon/The Denver Post via AP, Pool, File)

Devon Erickson making a court appearance at the Douglas County Courthouse in Castle Rock, Colo., this past May. (Joe Amon/The Denver Post via AP, Pool, File)

Authorities say the students entered a classroom through separate doors with guns taken from Erickson's house and opened fire with at least 29 people inside. A private security guard also injured one of the eight students when he fired at a sheriff's lieutenant in a hallway during the confusion, authorities said.

Castillo was one of the students who rushed Erickson in the classroom, along with Joshua Jones and Brendan Bialy. Castillo's parents watched the proceedings from the front row of the courtroom packed with members of the school community.

WOMAN ‘INFATUATED’ WITH COLUMBINE, CONNECTED TO COLORADO SCHOOL THREATS FOUND DEAD

Erickson had said he surrendered his handgun after being tackled by the three students, according to previously released summaries of police interviews with the suspects.

However, Pereira testified Tuesday that Bialy told investigators there was a struggle for the gun, and he was able to pry the weapon away from Erickson after punching him several times. Bialy also told investigators Erickson had pointed the gun at their heads.

However, no other students reported that Erickson pointed the gun at anyone in particular. One student told investigators Castillo charged Erickson before he could finish warning people not to move and his gun went off as soon as he pushed Erickson into the wall, making it seem like the firing was an accident, Stancil pointed out.

CLICK HERE FOR THE FOX NEWS APP

Pereira also said three spent bullet casings were found on the floor near Erickson, and one was found in his gun after an apparent malfunction. Erickson previously told police the impact of three students rushing him caused his gun to fire.

Erickson also told investigators McKinney forced him to participate in the shooting by threatening him with a gun and an ax. But investigators did not find evidence corroborating that, according to Pereira.

An October hearing has been scheduled for McKinney, who is charged as an adult. His attorneys have said they plan to ask a judge to move the case back to juvenile court.