The gunman who killed 26 people at a South Texas church Sunday, escaped from a mental health facility in New Mexico in 2012, according to documents obtained by KHOU 11 News.

Devin Kelley was admitted to the Peak Behavioral Health Services Center in Santa Teresa, New Mexico after beating his wife and child while stationed at Holloman Air Force Base.

On June 13, 2012, Kelley escaped from the center and fled across the state line to El Paso.

In the missing person report, Kelley was described as “a danger to himself and others as he had already been caught sneaking fire arms onto Hollomon Air Force Base.”

Photos: Sutherland Springs mourns church massacre victims

The report said Kelley “was attempting to carry out death threats” he had made on his military chain of command.

Soon after receiving the report, El Paso police arrested Kelley at a bus stop and turned him over to New Mexico police.

Kelley had been convicted of assault in a military court in 2012 for fracturing the skull of his young stepson, and the FBI should have barred him from buying the weapons, said Don Christensen, the service's top prosecutor whose office oversaw Kelley's Air Force prosecution. He also was convicted on another count for beating his wife.

The child was born in 2010, and the beatings began a year later, Christensen said. The boy suffered subdural hematoma, bleeding in his brain, from shaking and skull fractures, Christensen said. Kelley offered a partial confession to the charges and entered a plea agreement that capped his sentence at three years.

Photos: Sutherland Springs church shooting

Kelley was also convicted at court-martial of beating his wife and was jailed for one year. He also received a bad conduct discharge, not the harsher dishonorable discharge, and was busted to the Air Force's lowest rank.

Despite the convictions, the Air Force failed to flag Devin Kelley as banned from buying the weapons he used to kill 26 people and wound 20 more worshipers at a South Texas church on Sunday, the Air Force acknowledged late Monday.