El Paso officers who detained Devin Kelley five years ago 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 a 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 in June 2012, according to a police report first reported by KPRC in Houston.
Officers wrote that Kelley had fled Peak Behavioral Health Services in Santa Teresa, New Mexico, about 100 miles (160km) away.
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 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.
According to the Houston Chronicle newspaper, the 26-year-old killer had shown up at the First Baptist Church of Sutherland Springs with his children for an annual fall festival five days before the shooting.
A friend of Kelley’s former mother-in-law Michelle Shields, who officials believe he was targeting on Sunday, said she was glad to see him at last week’s event with her grandchildren following past family troubles.
“They thought, ‘oh this is good. This is progress,'” said the woman.
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 images.
Survivors have been describing how Kelley went pew to pew in the church shooting crying children.
In an interview with San Antonio television station KSAT, Rosanne Solis described the terror among congregants.
Armed with an assault rifle and 450 rounds of ammunition, the gunman began shooting into the small wooden building from outside.
Ms Solis, who was sitting near the entrance, said he stormed through the front of the church, shouting: “Everybody die!”
“Everybody was saying, ‘Be quiet! it’s him, it’s him!'” said Ms Solis.
She added: “Everybody got down, crawling under wherever they could hide. He was shooting hard.”
Witnesses said the gunman walked up and down the aisles looking for survivors to shoot.
Ms Solis’ husband, Joaquin Ramirez, told how he made eye contact with Annabelle Pomeroy – the 14-year-old daughter of the church’s pastor.
She was crying for help, Mr Ramirez told KSAT.
He said he motioned with his finger for her to stay quiet. Annabelle was killed.
Mr Ramirez said the gunman also killed young children who were crying, shooting them at point-blank range.
He and his wife survived by playing dead, though she was shot in the arm and he was hit by shrapnel.
Another survivor, Farida Brown, 73, had a narrow escape, her son David Brown told KENS-TV.
“The shooter was making his rounds, and he ended up there and started shooting this lady multiple times,” Mr Brown told the station.
“And the lady looked at my mom the whole time, and my mom was looking at her and telling her, ‘It’s OK, you’re going to go to heaven. You’re going to go to heaven.’
“And then she knew it was her turn to be shot, and so she just started praying that God would take her soul to heaven.”
But at that moment a neighbour, Stephen Willeford, entered the church and began shooting at Kelley.
As Kelley fled in his car, Mr Willeford flagged down a passing motorist, Johnnie Langendorff.
The two gave chase in Mr Langendorff’s pickup truck until Kelley’s vehicle crashed in a ditch.
The gunman was found dead of a self-inflicted gunshot wound to the head, say police.