Media playback is unsupported on your device Media caption The BBC's David Willis: "Verdict was met by surprise and disappointment"

A jury in the US state of Colorado has spared gunman James Holmes the death penalty for killing 12 people at a screening of a Batman film in 2012.

He will serve life in jail without the possibility of parole.

The defence team had argued that the former neuroscience graduate student, now 27, was insane at the time.

The jury agreed with prosecutors that Holmes, though mentally ill, was responsible for his actions. But it was not unanimous on the death penalty.

That lack of agreement meant the jury accepted he would receive an automatic life sentence without parole.

One juror later told NBC News that two members of the jury were "on the fence" about the death penalty but that another was adamantly opposed on the grounds of mental illness.

"We ended our deliberations when one absolutely would not move," the juror said.

The decision of the jury - a panel of nine women and three men - was revealed by Judge Carlos Samour in a courtroom in the city of Centennial on Friday.

Image copyright AP Image caption James Holmes (top left in a tan shirt) declined to testify in his own defence

As the verdict was read out, Holmes' mother Arlene leaned her head against her husband's shoulder and began sobbing, the AP news agency reported.

Ashley Moser, whose six-year-old daughter Veronica died in the attack and who was herself paralysed, shook her head and then slowly leaned it against the wheelchair of another paralysed victim.

"We just have to deal with it and accept it," said Robert Sullivan, Veronica's grandfather. "He's living. He's breathing and our loved ones are gone. The gaping void we have for our grand-daughter has been replaced with a new abscess of him living."

District Attorney George Brauchler said: "I still think death is justice for what that guy did, but the system said otherwise. I honour that, and I'll respect that outcome."

During his three-month trial, Holmes declined to testify in his own defence or to make a statement expressing his remorse.

The sentence is expected to be imposed formally at a later hearing.

Killer was 'socially awkward' PhD student

James Holmes was considered a quiet young man before the attack. He had been studying for a PhD in neuroscience at the University of Colorado at Denver, although he was about to quit.

"He basically was socially awkward, but not to the degree that would warrant suspicion of mass murder or any atrocity of this magnitude," said Billy Kromka, a research assistant at a lab where he spent several months.

The FBI said Holmes had no significant criminal record - local police said he had a speeding ticket from 2011 - and no links to terrorism.

The prosecution said he was listening to loud techno music on headphones during the assault "to block out the screams" as he opened fire.

Who were the victims?

Profile: Aurora gunman James Holmes

In July, Holmes was convicted on 165 counts of murder, attempted murder and an explosives charge over the shootings in Aurora, Colorado.

Families of victims had appeared to be conflicted over whether he should get the death penalty. Some were worried about the long appeal process that often follows a death sentence.

On 20 July 2012, Holmes slipped into a midnight screening of Batman film The Dark Knight Rises armed with a semi-automatic rifle, a shotgun and a pistol.

He threw smoke canisters and shot at people trying to escape.

Prosecutors argued the attack was clearly premeditated, with Holmes planning and amassing weapons for months, as well as booby-trapping his apartment to kill anyone who tried to enter.

His parents, Robert and Arlene Holmes, insisted their son was "not a monster" but suffered from severe mental illness.

The Aurora shooting victims

Image copyright AP Image caption Families of victims have been conflicted about Holmes' fate

John Larimer, 27, US Navy cryptologist

Jessica Ghawi, 24, aspiring sports journalist

Alex Sullivan, 27, restaurant worker

Micayla Medek, 23, student

Veronica Moser, six

Jesse Childress, 29, Air Force cyber-systems operator

Alex Teves, 24, former student

Matt McQuinn, 27, retail worker

Alexander Boik, 18, student

Jonathan Blunk, 26, US Navy veteran, working for small flooring company

Rebecca Wingo, 32, mobile medical imaging company worker

Gordon Cowden, 51, business owner