DENVER (Reuters) - A transgender teenager who told police that he and a friend opened fire at a suburban Denver high school to exact revenge on classmates who bullied him should be tried on murder charges as an adult, a judge ruled on Wednesday.

FILE PHOTO: Police vehicles are stationed outside the school following the shooting at the Science, Technology, Engineering and Math (STEM) School in Highlands Ranch, Colorado, U.S., May 8, 2019. REUTERS/Rick Wilking/File Photo

Alec McKinney, 16, was ordered along with Devon Erickson, 19, to stand trial on first-degree murder, attempted murder and weapons charges in the May 7 shooting rampage at the Science, Technology, Engineering and Math (STEM) School in Highlands Ranch, Colorado, in which one student was killed and eight others wounded.

Kendrick Castillo, 18, was shot to death when he ran toward one of the two assailants in what has been called a heroic effort to stop the shooting and save lives.

McKinney, who was born female but identifies as male, told police later that he was in a “pre-op transitioning phase” and was seeking revenge on students who picked on him for being transgender.

Defense attorneys sought to have the case moved to juvenile court, citing McKinney’s mental health issues and a troubled childhood that included witnessing domestic violence committed by his father against his mother.

In issuing a seven-page ruling on Wednesday, Douglas County District Judge Jeffrey Holmes acknowledged that the defendant had suffered “serious trauma,” but declined to move the case.

“Based on the totality of the evidence before it, the Court finds that it is has not been proved that the juvenile and the community would be better served by transferring this case to juvenile court,” Holmes wrote.

If convicted of the murder charge at trial, McKinney faces up to 40 years in prison. Had the case been sent to juvenile court, the maximum sentence was seven years.

The Colorado Public Defender’s Office, which represents McKinney, declined to comment.

District Attorney George Brauchler had no immediate comment, a spokeswoman said.

Erickson was bound over for trial in September and is scheduled to enter a plea on Friday.

Since he was 18 at the time of the shooting, Erickson could face the death penalty or a mandatory sentence of life without the possibility of parole if he is convicted of the murder.

According to court documents, McKinney and Erickson armed themselves with three handguns and a 22-caliber rifle and took cocaine before carrying out the rampage.