In the course of a short and troubled life, Devin Patrick Kelley, the gunman who killed 26 people and wounded 20 more at a Texas church on Sunday, beat his wife and infant stepson, was court martialled, and escaped a mental health clinic.
Kelley, who was 26 when he killed himself, moments after the shooting, began military service with the US Air Force in 2010 and served in its logistical readiness department based at Holloman air force base in New Mexico.
In 2012, two years into his military career, he came up before a court-martial for the assault on his wife and stepson - the young boy's skull was reportedly fractured - and was sentenced to a year's confinement and demoted in rank.
Later that year he escaped from a mental health clinic in Santa Teresa, New Mexico, before being caught, according to a local police report. The report stated that he had attempted to sneak weapons onto the air base and "carry out death threats" against his chain of command.
Kelley's first wife, Tessa, divorced him during his confinement, according to reports. He was released in 2013 and finally left the military in 2014 with a "bad conduct" discharge.
He remarried in April 2014 to Danielle Shields. Law enforcement officials described the couple as estranged, the New York Times reported. Police have said that the shooting may have followed an argument between Kelley and Ms Shield's mother, Michelle, who worshipped at the church.
Michelle Shields was not present during the shooting, at the First Baptist Church of Sutherland Springs, Texas, but her mother, Lula White, was killed in the hail of bullets, according to relatives' Facebook posts and interviews with the New York Daily News.
Kelley fired many times inside the small church, clad in black tactical style clothing and using a military-style rifle. His victims ranged in age from from 5 to 72, authorities said.
According to Texas Governor Greg Abbott, Kelley was denied a permit for a gun by the state of Texas and should not have legally been allowed to own a firearm.
Mr Abbott said it was important to ascertain how Kelley "slipped through the crack" in acquiring an assault rifle, given that he was "a powder keg waiting to go off".
The killer's fragile mental state was likely worsened by his volatile relationship with his mother-in-law, who had received threatening text messages from him shortly before the shooting.
Kelley's now-deleted Facebook page featured a photo of what appeared to be an assault rifle and a Mark Twain quote: "I do not fear death. I had been dead for billions and billions of years before I was born and had not suffered the slightest inconvenience from it."
The suspect's LinkedIn page lists the causes he cares about, said to include animal welfare, arts and culture, children and civil rights. He describes himself as a "hard working, dedicated person" who has a high school diploma and is a "management consultant".
Devin Kelley's brushes with the law and the military
- A series of legal troubles began in 2012 when he was court-martialled and sentenced to a year in military prison for assaulting his wife and child
- In the same year Tessa Kelley filed court papers to divorce Kelley, with her wish being speedily granted. There were no children listed in the proceedings
- After his jail term ended in 2014, Kelley was demoted in rank and released from the military with a bad conduct discharge
- In August 2014 he again appeared in court - this time charged with mistreating, neglecting or being cruel to animals. The case was eventually dismissed
Kelley grew up in New Braunfels - about 35 miles (56km) north of Sutherland Springs - in the $1m home of his parents, the New York Times says. It was there that he was accused of assaulting his wife and stepson. He remarried in 2014.
After leaving the military, Kelley worked for just over five weeks as a security guard for an amusement park in New Braunfels owned by the Schlitterbahn company.
"His employment was terminated in July," the company said in a statement. He was "a seasonal unarmed night security guard" Schlitterbahn said, and had passed a criminal background check.
Some reports say that he lived for a while in a caravan park in a rural area. At night-time he could be heard firing weapons, US media report.
He is described as a loner with a number of minor traffic offences who posted about atheism online after giving up his role as a teacher in summer Bible classes.
Two former girlfriends told NBC News that Kelley's behaviour had become "disturbing - even violent" after they broke up with him.
"Years after dating me he would try to bribe me to hang out with him," Katy Landry told the channel in a Facebook message. "He ended up assaulting me. He would stalk me by repeatedly calling me - even prank calling me saying really weird stuff."
Another woman, Brittany Adcock, 22, said Kelley pressured her into having sex when she was 13 and he was 18. She told NBC he had continued to pester and harass her when she finished with him after two months.
US officials say there is no evidence to suggest Kelley was linked to organised terrorists.