(CNN) The man who killed more than 20 people at a small Texas church escaped from a mental health facility five years ago after sneaking guns onto an Air Force base and making threats against commanders, according to a police report.

Devin Patrick Kelley's June 2012 escape from Peak Behavioral Health Systems in New Mexico occurred months after he was accused of abusing his ex-wife and her child, according to an El Paso Police Department report obtained by CNN affiliate KVIA on Tuesday.

Kelley was picked up after the Santa Teresa, New Mexico, facility listed him as missing. The documents said officers had been warned that Kelley was a danger to himself and others and that he had sneaked firearms onto Holloman Air Force Base, where he had reportedly threatened his commanders.

Kelley had been placed into pretrial confinement at a civilian facility days before his escape, according to two Air Force officials.

"My heart is broken," said Wilson County Commissioner Albert Gamez Jr. "We never think where it can happen, and it does happen. It doesn't matter where you're at. In a small community, real quiet and everything, and look at this, what can happen."

"My heart is broken," said Wilson County Commissioner Albert Gamez Jr. "We never think where it can happen, and it does happen. It doesn't matter where you're at. In a small community, real quiet and everything, and look at this, what can happen."

The FBI responded to the scene of the shooting, according to Michelle Lee, spokeswoman for the FBI's San Antonio field office.

The FBI responded to the scene of the shooting, according to Michelle Lee, spokeswoman for the FBI's San Antonio field office.

Carrie Matula embraces a woman after the shooting. Matula said she heard the shooting from the gas station where she works across the street.

Carrie Matula embraces a woman after the shooting. Matula said she heard the shooting from the gas station where she works across the street.

Emergency personnel seal off the scene of the mass shooting.

Emergency personnel seal off the scene of the mass shooting.

Flags are lowered to half staff at First Baptist Church following the shooting.

Flags are lowered to half staff at First Baptist Church following the shooting.

Law enforcement officials gather near the First Baptist Church. The shooter was killed after a brief chase north into neighboring Guadalupe County, according Guadalupe County Sheriff's Office spokesman Robert Murphy.

Law enforcement officials gather near the First Baptist Church. The shooter was killed after a brief chase north into neighboring Guadalupe County, according Guadalupe County Sheriff's Office spokesman Robert Murphy.

Investigators work at the scene. Victims range in age from 17 months to 77 years old.

Investigators work at the scene. Victims range in age from 17 months to 77 years old.

People comfort each other at a community center near the scene of the deadly shooting.

People comfort each other at a community center near the scene of the deadly shooting.

Investigators work at the scene of a mass shooting at the First Baptist Church in Sutherland Springs, Texas, on Sunday, November 5. A man opened fire inside the small community church, killing at least 26 people.

Investigators work at the scene of a mass shooting at the First Baptist Church in Sutherland Springs, Texas, on Sunday, November 5. A man opened fire inside the small community church, killing at least 26 people.

As investigators try to piece together a picture of Kelley, more clues have emerged in the deadliest shooting in modern Texas history. Authorities placed the death toll at 26, including an unborn child. The dead parishioners from the First Baptist Church in Sutherland Springs ranged in age from 17 months to 77 years old.

Kelly had previously attended the Texas church but he was not welcomed there, Wilson County Sheriff Joe Tackitt told CNN on Tuesday.

Pastor Frank Pomeroy of First Baptist Church knew Kelley from his attendance at church events, according to Tackitt. The pastor wanted him out.

There were no threats but Pomeroy told authorities Kelley "was not a good person to be around."

"He did not think that he was a good person and did not want him around his church," Tackitt said of the pastor. "But he said, 'How do I run him away from my church?'"

On Sunday, Kelley reappeared at the church. This time, he was armed with an assault rifle, 15 loaded magazines and an obsession with a family dispute.

Kelley, who had a record of violence, was consumed by a dispute with his mother-in-law and spent time posting anti-God and pro-gun statements on Facebook in the months before the shooting, according to officials, as well as acquaintances and former classmates.

He sent threatening text messages to his mother-in-law and texted her as recently as Sunday morning -- not long before he sprayed bullets at the people in the church with an assault rifle, authorities said. He may have thought she was at church on Sunday.

"There are many ways that he could have taken care of the mother-in-law without coming with 15 loaded magazines and an assault rifle to a church," said Freeman Martin of the Texas Department of Public Safety.

Latest developments

The FBI has the shooter's cellphone, but has not yet accessed its content due to encryption, a growing challenge for law enforcement, Christopher Combs, FBI special agent in charge, said at a Tuesday news conference.

As of Tuesday, 10 of the wounded remained in critical condition, Martin said.

In an October 29 Facebook post, Kelley posted a photo of a Ruger AR-556 rifle -- the same type used in the shooting -- on a white couch, former classmates and members of the community told CNN. The caption read, "She's a bad bitch." It's not clear if it was the same weapon he used on Sunday.

A crime victims compensation fund will provide $6,500 to families of the victims for funeral expenses, officials said. A funeral company has donated caskets.

The US Air Force acknowledged it did not relay information about Kelley's court martial conviction for domestic assault to civilian law enforcement, something that could have prevented him from purchasing the firearms used in the shooting. The Air Force and Department of Defense are investigating how records of his domestic violence conviction were handled.

Kelley, 26, had three gunshot wounds. He was shot in the leg and torso by an armed citizen, and had a self-inflicted shot to the head, authorities said. It wasn't clear which gunshot killed Kelley, but evidence at the scene "indicates the subject may have died from a self-inflicted gunshot wound," Martin said. He was found dead in his vehicle.

Learning more about the shooter

Officials had said there was a domestic situation involving Kelley, but didn't go into any details.

"This was not racially motivated. It wasn't over religious beliefs. There was a domestic situation going on with the family and in-laws," said Christopher Combs, the special agent in charge of the FBI's San Antonio division.

Kelley had also expressed anger toward his mother-in-law, Martin said.

His grandmother-in-law was killed during the attack, multiple friends of the woman told CNN. Lula White was the grandmother of Kelley's current wife and often volunteered at the church, according to friends and her Facebook profile.

Lula White was killed by her grandson-in-law, friends said.

Public records, and those who knew Kelley, describe a troubling history.

Kelley was the subject of an investigation for sexual assault and rape in 2013 in Comal County but the investigation ended without any charges, Sheriff Mark Reynolds said.

In 2014, law enforcement responded to a disturbance call at an address where Kelley and his then-girlfriend lived. Police notes from the event say it was considered a misunderstanding.

Christopher Leo Longoria went to high school with Kelley. He said his former classmate would focus on women's reactions and that it would "creep out the ladies." Longoria said he had recently unfriended Kelley on Facebook because of personal attacks against his friends.

"He was also posting a lot of non-God beliefs, atheism, a lot of gun violence and a lot of weapons that he was into," Longoria told CNN.

Longoria described Kelly's Facebook posts as "a ridiculous amount of nonsense." Kelly's page has been taken down but people in the community have confirmed its existence and content.

His social media suggested a fascination with mass shootings, a law enforcement official said.

Kelley served at the Holloman Air Force Base beginning in 2010, but was discharged in 2014. He was court-martialed in 2012 for assault on his spouse and child. Kelley served a year in military prison and received a bad conduct discharge, according to Air Force spokeswoman Ann Stefanek.

Kelley was involved in "multiple occasions of domestic abuse" against his ex-wife and stepson, said Don Christensen, who was the Air Force chief prosecutor when Kelley was sentenced.

He said Kelley "violently" shook the child, causing fractures in his skull and a subdural hematoma, a severe head injury in which there is bleeding between the skull and the brain.

Kelley "admitted to, out of anger, pushing his son down and injuring him," Christensen said.

The gunman had been also arrested in August 2014 on an animal cruelty charge in El Paso County, Colorado, after a witness said he had punched a dog, grabbed it by the neck and dragged the animal. Kelley denied the account and was issued a summons but didn't spend any time in jail.