SUTHERLAND SPRINGS, Texas — The gunman who carried out the massacre of 26 people at a small-town Texas church briefly escaped from a mental health center in New Mexico in 2012 and got in trouble for bringing guns onto a military base and threatening his superiors there, police reports indicate.

The shooter was also named as a suspect in a 2013 sexual assault in his Texas hometown of New Braunfels, about 35 miles from the scene of the church attack.

The records that emerged Tuesday add up to at least three missed opportunities that might have offered law enforcement a way to stop the shooter from having access to guns long before he slaughtered much of the congregation in the middle of a Sunday service. The shooter died of a self-inflicted gunshot wound after he was chased by bystanders and crashed his car.

The Air Force confirmed Tuesday that the shooter had been treated in the facility after he was placed under pretrial confinement stemming from a court-martial on charges that he assaulted his then-wife and hit her child hard enough to fracture the boy's skull.

Involuntary commitment to a mental institution would have been grounds to deny him a weapon provided that records of his confinement were submitted to the federal database used to conduct background checks on people who try to purchase guns.

The shooter was also caught trying to bring guns onto Holloman Air Force Base in New Mexico when he was stationed there, according to an El Paso, Texas, police report released Tuesday.

While in the military, the shooter, who was 21 at the time, made death threats against superior officers, according to the June 2012 report, which also mentioned the military charges. He was eventually sentenced to 12 months of confinement for the assault.

The Air Force acknowledged Monday that it did not enter the shooter's criminal history into the federal database as required by military rules, another way he could have been denied a weapon.

Had the shooter been convicted of sexual assault, he would likely have been prevented from purchasing a gun because federal guidelines prohibit sales to anyone convicted of a felony punishable by more than one year in prison. The Comal County sheriff said he was reviewing whether his department mishandled the sexual assault investigation.

Authorities recovered a Ruger AR-556 rifle at the church and two handguns from the shooter's vehicle. All three weapons were purchased by the shooter, said Fred Milanowski, the agent in charge of the Bureau of Alcohol, Tobacco, Firearms and Explosives in Houston.

The El Paso report notes that The shooter was committed to a mental health facility in Santa Teresa, New Mexico, but at some point escaped and was later found by police at a bus station in downtown El Paso in June 2012.

Deputies were called to the shooter's home in New Braunfels in June 2013 about the rape case and investigated for three months, Comal County Sheriff Mark Reynolds said. But it appeared that they stopped investigating after they believed the shooter left Texas and moved to Colorado. Reynolds said the case was then listed as inactive.

The sheriff said he was trying to determine how deputies came to believe The shooter had moved and why they did not continue to pursue the case, either in Colorado or after The shooter returned to the area later. Deputies were called to the same house in February 2014 to investigate a domestic violence report involving the shooter and his girlfriend at the time.

"The last information that we have is the suspect moved to Colorado and then the investigation seems to have tapered off," Reynolds said Tuesday. "That's what we're looking into."

The district attorney for Comal County said in an interview that she became aware of the sexual assault case Monday before the records were released to The Associated Press and other media.

"That case was never presented to our office," Jennifer Tharp said.

The records from Comal County also describe a burglary that the shooter's father, Michael, reported on his property the day after the sexual assault report.

None of the documents explains whether there was a connection between the sexual assault report and the burglary report.

Meanwhile at the First Baptist Church in tiny Sutherland Springs, investigators continued analyzing a gruesome crime scene and tried to gain access to the shooter's cellphone, a longstanding challenge for the FBI in thousands of other cases.

Authorities aimed to conclude the crime-scene investigation at the church by Wednesday evening. Investigators have no reason to believe anyone conspired with the shooter, who acted alone, said Texas Department of Public Safety Regional Director Freeman Martin.

Martin repeated earlier statements that the shooting appeared to stem from a domestic dispute involving the shooter and his mother-in-law, who sometimes attended services at the church but was not present on Sunday.

"We don't know what he was thinking or what was in his mind," Martin said. "There was conflict. He was upset with the mother-in-law."

Also Tuesday, authorities explained that the death toll of 26 included the unborn baby of one of the women killed.

The gunman's phone was flown to an FBI lab for analysis, but agents have yet to access it, said Christopher Combs, who is in charge of the agency's San Antonio division.