Three years after a gunman opened fire inside a Colorado movie theater, killing a dozen people in one of the deadliest mass shootings in the country’s history, a jury has found the shooter guilty on each of the 165 charges he faced.

The verdict came after an emotional, months-long trial, one that unfolded just half an hour away from the theater where the massacre took place.

James Holmes pleaded not guilty by reason of insanity. His attorneys acknowledged in a court filing two years ago that he was the gunman, writing that Holmes “was in the throes of a psychotic episode when he committed the acts that resulted in the tragic loss of life and injuries sustained by moviegoers on July 20, 2012.”

Moviegoers were gathered for a midnight screening of “The Dark Knight Rises” when a lone gunman began a bloody rampage inside the theater in Aurora, a suburb of Denver. People in the audience dove to the floor or tried to flee, and witnesses at the time said Holmes calmly and silently walked through the theater, shooting at adults and children. During the trial this year, victims and others offered tearful, pained stories of what happened inside the theater and what has happened since.

James Holmes was found guilty on Thursday of multiple counts of first-degree murder and attempted murder for the 2012 shooting at movie theater in Aurora, Co. (Reuters)

Prosecutors argued that Holmes meticulously planned the crime, insisting that he was sane and arguing that he should be held responsible for the bloodshed. Holmes’s attorneys, meanwhile, argued that his mental illness was to blame for the shooting.

The two sides effectively boiled the trial down to one issue: Was Holmes sane at the time of the attacks? George Brauchler, district attorney for the area including Arapahoe County, insisted that Holmes was solely focused on committing a mass murder. Attorneys from the Colorado State Public Defender argued that Holmes was adrift from reality and had lost his mind to psychosis.

Now that Holmes has been found guilty, the next step in the trial is the penalty phase. Court officials say this phase could last as long as a month before Holmes is sentenced to death or life in prison. In Colorado, death row inmates are held at the Sterling Correctional Facility, about 125 miles northeast of Denver, before they are moved to a different penitentiary for execution.

A death sentence would be a rarity for Colorado, as would an execution. Colorado sentenced 22 people to death between 1973 and 2013, according to the Justice Department, a number exceeded by 30 other states and the federal government over that period. The state has three inmates on death row and has executed only one inmate since the Supreme Court reinstated the death penalty in 1976.

Holmes faced 165 total charges in this case, nearly all of them for murder or attempted murder. He was also charged with one count of possessing an explosive device. He was found guilty on every single charge.

Jurors had the option of finding him guilty, not guilty or not guilty due to insanity for any of the charges, while prosecutors had to prove beyond a reasonable doubt that Holmes was not insane.

Carlos A. Samour, Jr., the district judge overseeing the trial, gave the jurors 62 pages of instructions and reminded them not to consider Holmes’s potential punishment.

While he noted that the penalty itself would be decided during a later phase, he told jurors what would happen if they accepted the insanity defense, adding that he was providing the detail for informational purposes only.

“If the defendant is found not guilty by reason of insanity, he will never again be tried on the merits of the criminal charges filed against him,” Samour wrote.

Ultimately, Samour told jurors to “consider all the evidence in light of your experience in life.”

The trial was pushed back multiple times by delays, including arguments over evaluations of Holmes’s sanity, before jury selection finally began in January.

It is an unusual trial, because after mass or active shootings, the people opening fire are usually killed by police or at their own hands. They rarely go on to stand trial, and the shooting sprees are followed by questions about what else could have been done and what warning signs were missed.

Trials like Holmes’s, or that of Nidal Hasan, the Army psychiatrist sentenced to death for killing 13 people at the Fort Hood military installation in 2009, occur less frequently. The recent shooting at a church in Charleston, S.C., appears likely to join this list, as the accused gunman there has been indicted and charged with nine counts of murder.

Before the Aurora trial began, Holmes’s parents pleaded for their son’s life to be spared. They also criticized the idea of a trial that would force people to relive what happened three years ago.

“We do not know how many victims of the theater shooting would like to see our son killed,” Robert and Arlene Holmes wrote in a letter published by the Denver Post. “But we are aware of people’s sentiments. We have read postings on the Internet that have likened him to a monster. He is not a monster. He is a human being gripped by a severe mental illness.”

Instead, they argued that their son should be institutionalized or imprisoned for the rest of his life.