The gunman who killed 26 churchgoers in Texas escaped a mental health clinic in 2012, according to a police report.
El Paso officers who detained Devin Kelley were told he was “a danger to himself and others”.
Kelley had been sent to the hospital after he was court-martialled for assaulting his ex-wife and stepson during his stint in the US Air Force.
He was “attempting to carry out death threats” against “his military chain of command”, the report states.
Officials say the assault charge should have legally barred him from owning guns.
El Paso police arrested Kelley at a bus terminal in downtown El Paso on the evening of 7 June 2012, according to a police report first revealed by KPRC in Houston.
In the report, police wrote that Kelley had escaped from Peak Behavioral Health Services in Santa Teresa, New Mexico, about 100 miles (160km) away.
Media playback is unsupported on your device Media captionTexas shooting: How to spot a hoax
The person who reported him missing from the facility told police Kelley “suffered from mental disorders”.
Kelley “had already been caught sneaking firearms onto Holloman Air Force Base”, the report adds.
Later that year, Kelley pleaded guilty in a military court to repeatedly assaulting his wife and his toddler stepson.
He was sentenced to one year in a US Navy prison.
FBI investigators said on Tuesday they have been trying to unlock Kelley’s mobile phone, to better understand what led him to carry out the mass shooting.
Image copyright Getty Images
Survivors have been describing how Kelley went pew to pew in the church shooting crying children at point blank range.
According to the Houston Chronicle newspaper, the killer had five days earlier shown up at the First Baptist Church of Sutherland Springs with his children for an annual fall festival.
A friend of 26-year-old Kelley’s former mother-in-law Michelle Shields, who officials believe he was targeting on Sunday, said she was glad to see him at the event with her grandchildren.
“They thought, ‘oh this is good. This is progress,'” said the woman, who is described as a longtime resident and family friend.
Photos of the event on the church’s Facebook page show children dressed in Halloween costumes and playing games.
Several of the victims are also shown in the series of more than 40 photos.