In retrospect, the warning signs were there.
Before Devin Patrick Kelley carried out the deadliest mass shooting in Texas history on Sunday, the former airman had displayed a pattern of violent and disturbing behavior.
Domestic violence. Sexual assault accusations. Animal cruelty. Escape from a mental health facility. Threatening text messages. An obsession with guns and mass shootings.
The signs may seem obvious now, though psychiatrists caution against what they call hindsight bias.
But in the moment, none of it prevented Kelley from buying the semi-automatic rifle he used to kill 25 people and an unborn child at First Baptist Church in Sutherland Springs.
As investigators piece together a portrait of the dead gunman, questions remain about what set him off and what possibly could have been done to prevent the massacre, renewing fierce debates over gun control.
President Donald Trump called the mass shooting a "mental health problem at the highest level," not a "guns situation." Though Kelley's mental health history has not been fully disclosed, experts cautioned against focusing on that factor to the exclusion of others. No single factor on its own, including a diagnosis of mental illness, can predict how a person will act. But, certain indicators carry more weight than others, said Duke University professor Jeffrey Swanson.
"A history of violent behavior is a far better predictor of future violence than mental illness," said Swanson, a professor in psychiatry and behavioral sciences at Duke University who specializes in gun violence and mental illness. Though prevention is elusive, he said, "we could have better criteria for buying guns based on actual risk, and legal tools to remove guns based on risk."
'Somebody really dropped the ball'
Certain measures exist to prevent people like Kelley from obtaining firearms. His domestic violence record alone should have barred him under Texas law from purchasing four guns between 2014 and 2017. But his name did not show up in the federal database that licensed gun dealers are required to check before selling someone a firearm.
"Somebody really dropped the ball," former Air Force chief prosecutor Col. Don Christensen told CNN.
The Air Force acknowledged Monday it did not appropriately relay Kelley's court-martial conviction for domestic assault to civilian law enforcement, preventing it from appearing in three databases, including the FBI's National Instant Criminal Background Check System (NICS).
"Had his information been in the database, it should have prevented gun sales to Kelley," the Air Force said in a statement.
The Air Force said the Air Force inspector general is conducting an investigation into what happened.
In total, the shooter bought four weapons -- two in Colorado and two in Texas, the Bureau of Alcohol, Tobacco, Firearms and Explosives said.
Two handguns were found in his vehicle. A Ruger AR-556 rifle was found in front of the church where Kelley dropped it in a standoff with a local resident.
Kelley bought the rifle in April 2016 from an Academy Sports + Outdoors store in San Antonio, a law enforcement official told CNN. When Kelley filled out the background check, he did not check the box indicating he had a disqualifying criminal history, the official said. He listed an address in Colorado Springs, Colorado, when he bought the rifle, the official said.
At one point, the shooter tried to get a license to carry a gun in Texas, but the state denied it, officials said. In Texas, a permit is not required to buy a handgun or a long gun, and gun owners do not have to be licensed.
Loopholes notwithstanding, convictions for misdemeanor domestic violence and felonies are entered into the NICS databases. So are domestic violence restraining orders and dishonorable discharges from the military. But Kelley did not receive a dishonorable discharge for his assault convictions. After serving 12 months in a military prison, he received a bad conduct discharge in 2014.
A history of domestic violence
Kelley served in logistics readiness at Holloman Air Force Base in New Mexico from 2010 until his discharge for assaulting his then-wife and stepson. The two married in 2010 and divorced in 2012, according to court records.
While he was awaiting his court martial in June 2012, he escaped from Peak Behavioral Health Systems in Santa Teresa, New Mexico, according to documents from the El Paso Police Department obtained by KVIA. Officers were told that Kelley "suffered from mental disorders and was a danger to himself, having previously been caught sneaking firearms on the base, the documents said. Kelley had made death threats toward his chain of command.
When officers found Kelley, he did not resist or make any comments about harming himself or others to the officers, the documents said.
Kelley initially faced multiple charges, according to military records: assault and battery against his spouse, aggravated assault against his stepson and four charges involving firearms, including two of pointing a loaded firearm at his wife and two of pointing an unloaded firearm.
Military prosecutors dropped the firearms charges before trial in an agreement in which Kelley pleaded guilty to aggravated assault against the child and assault against his wife.
As part of his plea, Kelley admitted to hitting his stepson on the head and body "with a force likely to produce death or grievous bodily harm." As for his then-wife, Kelley admitted to hitting and kicking his her, choking her and pulling her hair.
Kelley repeatedly shook the boy, leading to injuries that fractured the young boy's skull and caused internal bleeding, Christensen told CNN.
The nature of the crimes suggested a propensity for violence that should have been taken more seriously, Christensen said. But the military justice system doesn't offer adequate treatment or services for transitioning to civilian life, leaving Kelley's history of violence unaddressed, he said.
Allegations of animal cruelty and sexual assault
After his release in 2014, Kelley landed in an RV park in Colorado Springs, Colorado. While there, a neighbor told police he saw him punch a dog.
Kelley denied the allegation but eventually pleaded guilty in October 2014 to an animal cruelty charge, according to court records. He was ordered to pay more than $500 in fines and restitution and complete an animal cruelty evaluation as part of a deferred sentence of 18 months of unsupervised probation. In March 2016, after Kelley met the terms, the guilty plea was withdrawn and the case was dismissed, the records show.
Meanwhile, in his hometown of New Braunfels, Texas, Kelley had started dating Danielle Shields, who would become his second wife. The couple married in April 2014, when she 19 and he was 23.
About two months before their marriage, a friend of hers contacted the Comal County Sheriff's Office to report that Shields said her boyfriend was abusing her, according to law enforcement records. When members of the sheriff's office showed up, they were told it was a "misunderstanding and teenage drama," according to notes from the incident.
It was not Kelley's first contact with the Comal County Sheriff's Office. In October 2013, he was investigated for an alleged sexual assault. By then, he was divorced from his first wife, but she was listed as a witness. "The alleged sexual assault investigation stalled sometime in October 2013," the sheriff's office said, leaving its status unclear.
CNN has been unable to reach the women who accused Kelley of sexual assault.
Co-worker: 'He wasn't chatty'
Kelley was supposed to show up Sunday at his security guard job at the Summit Vacation Resort in New Braunfels, manager Claudia Varjabedian told CNN. His shift started at 4 p.m. No one had heard from him when they turned on the news.
"We couldn't get our mouths to close. We were all shocked," Varjabedian said.
He had only worked at the family resort for five weeks, she said, describing him as quiet. "He wasn't chatty with people, but he was polite."
He never let on to his plans, she said. On Friday, he asked for clarification on a policy related to vehicles on the property.
"He didn't seem like he had any plans to leave or do anything," she said. "I wish I could help by telling other people what to look out for to prevent this in the future."
In June, Kelley was registered as a noncommissioned security officer, affiliated with Schlitterbahn Waterpark and Resort in New Braunfels, where he lived, according to the state Department of Public Safety. In order to complete the registration, Kelley would have submitted fingerprints and fees.
Kelley worked at the waterpark for 5½ weeks this summer as a seasonal unarmed night security guard before he was terminated, Schlitterbahn representative Winter Prosapio told CNN. The park has not provided a reason for his termination.
Troubling Facebook posts
Kelley was consumed by a dispute with his mother-in-law, investigators said. He sent threatening text messages her law and texted her as recently as Sunday morning -- not long before he opened fire in the church. He fled the scene after an exchange of gunfire with a local resident and was found dead in his car a few miles down the road. He had shot himself.
Kelley's social media posts suggested a fascination with mass shootings, according to a law enforcement official.
In addition to "non-God beliefs, atheism," his recent Facebook posts included "a lot of gun violence" and weapons that he was into," high school classmate Christopher Leo Longoria said.
Kelley had been launching personal attacks against friends on Facebook, too, Longoria said, leading him to unfriend Kelley about a month ago. He didn't want to see the posts on his Facebook feed.
A screenshot of an October 29 Facebook post, ostensibly from Kelley, shows a picture of a rifle. In the status field above the picture is the message, "She's a bad bitch."
Kelley's Facebook page was taken down Sunday, hours after the shooting. But people in the Sutherland Springs area confirmed its existence and contents with CNN.
A gun expert told CNN that the weapon in the picture could be a Ruger AR-556, the type of gun used in Sunday's shooting. It is not clear whether the rifle in the picture was the gun from the massacre.
Neighbor heard target practice
Robert Gonzalez lives near Kelley's residence in New Braunfels, about 35 miles north of Sutherland Springs. In the week before the shooting, he heard gunfire from Kelley's property every morning.
"A load of rounds that would always be going off this time," he told CNN. "I was concerned because it was so close to our house."
Gonzalez said his time in the armed forces helps him identify guns by their sound. What he heard from his neighbor's house could have been a .45 or an assault rifle, a burst of rapid fire all of a sudden, he said.
It's not unusual for people in the area to practice firing on targets, said Gonzalez. This time, though, it was an unusual amount of gunfire.