The defendant in a 2021 mass shooting that killed 10 people at a Colorado supermarket pleaded not guilty by reason of insanity on Tuesday after a judge ruled that the case can move to trial.

Attorneys for Ahmad Al Aliwi Alissa entered the plea on his behalf before Judge Ingrid Bakke in Boulder. Clad in an orange and white striped jail uniform, Alissa looked down in court and at times at the judge as she advised him of rights before his plea.

A plea of not guilty by reason of insanity involves whether someone’s mental health prevented them from understanding right from wrong when a crime was committed.

COLORADO SUPERMARKET MASS SHOOTER RULED MENTALLY COMPETENT TO STAND TRIAL

Colorado shooting tributes

Tributes hang on the temporary fence surrounding the parking lot in front of a King Soopers grocery store in which 10 people died in a late March 2021 mass shooting, April 9, 2021, in Boulder, Colorado.

BOULDER GROCERY MASSACRE LEAVES 10 DEAD INCLUDING COP, SUSPECT IN CUSTODY

Alissa is charged with murder and multiple attempted murder counts. Neither his attorneys nor anyone else has disputed that Alissa was the gunman.

Tuesday's hearing was held to decide if there was enough evidence for defendant Ahmad Al Aliwi Alissa, who has schizophrenia, to go on trial in the March 22, 2021, shooting at a crowded King Soopers store in Boulder, about 30 miles northwest of Denver.

Bakke ruled after Boulder Police Detective Sarah Cantu described how the gunman took just over a minute to kill most of his victims at the supermarket in the college town of Boulder. She said he targeted individuals who were moving and continued firing at them until they were dead.

"He found moving targets, pursued them and shot them until they stopped moving," Cantu said as prosecutors laid out their case against a mentally ill man recently deemed competent to stand trial in shooting.

Ten people including a police officer were killed in the attack. The first eight victims died within 69 seconds; all but one were shot multiple times and everyone who was shot was killed, Cantu testified.

Authorities have not determined a motive, Cantu said. But a forensic psychologist testified during a hearing in September that the 24-year-old Alissa bought firearms to carry out a mass shooting and indicated "there was some intention to commit suicide by cop."

He’s accused of killing nine shoppers and workers inside and outside the store as well as Officer Eric Talley, a father of seven and one of the first three police officers who entered the store.

At the September hearing, a forensic psychologist, Loandra Torres, also told the judge that Alissa knows his fingerprints were found on guns that could be used as evidence against him. He was arrested in the store after being shot by a police officer, part of a second wave of law enforcement that entered the store after the officer Talley was killed.

Tuesday's hearing was a required step in his prosecution, which until recently had been stalled because of Alissa's mental health.

For families of victims, it is an important milestone. Robert Olds, whose niece Rikki Olds was killed, was in the front row of the courtroom. He said he wanted justice on behalf of his niece, a 25-year-old front-end manager at the supermarket.

"It’s the last fight, the last stand for my niece who can’t be here to do that herself because this guy murdered her," Robert Olds said.

Authorities have said Alissa legally purchased the AR-556 pistol, which resembles a rifle, used in the attack. The families of some of the victims are suing its manufacturer, Sturm, Ruger & Co., saying it markets the gun in a "reckless" and "immoral" way that promoted its killing capability and glorified lone gunmen. In a court filing, the company said its marketing does not promote illegal activity and that the lawsuit is trying to unconstitutionally punish its lawful and protected commercial speech.

Alissa was declared mentally incompetent in late 2021 and sent to the state mental hospital for treatment. After he was forcibly medicated, experts this summer said his condition had improved significantly. Last month, Bakke ruled that Alissa was competent to be prosecuted over the objections of the defense after hearing testimony from psychologists.

BOULDER MASS SHOOTING SUSPECT SLAPPED WITH MORE CHARGES: DA

Initial evaluations throughout 2021 and 2022 found Alissa incompetent for trial largely due to his inability to communicate clearly and at times his outright refusal to discuss the allegations against him, authorities had testified.

Mental competency involves whether a defendant is able to understand court proceedings and communicate with his lawyers to help his own defense — a different legal issue than a plea of not guilty by reason of insanity.

Alissa's family immigrated from Syria, he became a U.S. citizen and they lived in a middle-class neighborhood in a Denver suburb, where the family also had a restaurant.

The only known problem prior to the shooting was in 2018 when Alissa was convicted of assaulting a fellow high school student, a misdemeanor, according to police documents. A former classmate also told The Associated Press that Alissa was kicked off the wrestling team after yelling he would kill everyone following a loss in a practice match.