Texas church shooting: Gunman had fled mental hospital in 2012
Kelley had been hospitalized after being court-martialled by the US Air Force for assaulting his ex-wife and infant stepson.
The assault charges legally barred him from owning firearms. It remains unclear how he secured the guns used in the shooting.
More details emerge about Texas church shooter
Kelley "suffered from mental disorders", was deemed a "danger"
In June 2012, Kelley fled from the Peak Behavioral Health Services in Santa Teresa, New Mexico.
The hospital reported him missing and told police that he "suffered from mental disorders" and that he was "a danger to himself and others."
He was arrested by police at a bus terminal in El Paso, Texas, according to a police report.
Kelley sneaked firearms into airbase to attack superiors
The police report said Kelley "had already been caught sneaking firearms onto Holloman Air Force Base," where he was stationed with his then-wife and stepson.
He was "attempting to carry out death threats" against "his military chain of command."
Kelley later pleaded guilty in a military court for repeatedly assaulting his wife and stepson and was imprisoned for a year in a naval prison.
Love World news?
Stay updated with the latest happenings.
Witnesses say Kelley shot children at point-blank range
Meanwhile, witnesses to the horrific shooting told reporters that Kelley had stormed into the church and shouted "Everybody Die!" before he opened fire.
"Everybody got down, crawling under wherever they could hide. He was shooting hard," said Rosanne Solis, a survivor of the shooting.
He walked up and down the aisle looking for survivors and didn't hesitate to shoot crying children at point-blank range.
Row with mother-in-law may have motivated gunman's rampage
"This was not racially motivated, it wasn't over religious beliefs," said Freeman Martin, the regional director for the Texas Department of Public Safety.
"There was a domestic situation going on with the family and in-laws," he said.
Kelley had sent threatening texts to his mother-in-law.
"We know that he expressed anger towards his mother-in-law, who attends this church," Martin added.
#SaudiPurge: What Crown-Prince Salman's actions mean for Saudi-Arabia
#DefenseDiaries: INS Chakra, the deadliest shark in the Indian Ocean