AUSTIN — The man who killed 26 people at a church in Sutherland Springs two years ago tried to buy a gun from one sporting goods store before he was able, just months later, to purchase the AR-style rifle he used in the shooting from another retailer, according to his wife.

In an affidavit provided to a group of local families who are suing Academy Sports + Outdoors, Danielle Kelley wrote that her husband, Devin Kelley, tried to purchase a rifle from a Dick’s Sporting Goods store in New Braunfels in late 2015. At the time, the couple lived in Colorado, where high-capacity magazines are banned, and her husband presented an ID from that state, so the manager turned him away, she said.

A few months later, however, Kelley purchased a rifle at an Academy store in Selma, a San Antonio suburb, his wife explained.

“It was a quick and easy transaction. It is my understanding that the firearm Devin used in the Sutherland Springs shootings was the AR 556 that Devin bought at Academy,” Danielle Kelley wrote. “After Devin purchased the AR, we consistently went back to Academy in Selma. With each visit to Academy, which happened about once a month, Devin would purchase additional magazines and multiple boxes of ammunition.”

Kelley added she was unaware of her husband’s criminal history, which made his possession of any firearms illegal.

Kelley’s affidavit marked a win for the Sutherland Springs families suing Academy. They claim the retailer’s employees broke federal law by selling an out-of-state resident a magazine banned in his state of residence, accuse the retailer of gross negligence and seek damages for physical and mental anguish, disfigurement and medical expenses.

Irene and Kenneth Hernandez and their daughter Miranda Hernandez say a prayer in front of some of the 26 crosses placed in a field in Sutherland Springs to honor those who were killed in the mass shooting on Sunday, Nov. 5, 2017, when a gunman opened fire at a Baptist church in the small town southeast of San Antonio. (Louis DeLuca / Staff Photographer)

Academy, which is headquartered in Katy, has declined to comment on the lawsuit. The sporting goods chain says it’s not responsible for the shooting because Kelley passed a background check. It argues that federal law defines “firearm” and “magazine” as different and separate things, which means the sale appeared to be legal.

Kelley, a veteran, had a history of domestic abuse and other violent behavior that the U.S. Air Force admitted it failed to report to a federal criminal database, allowing him to purchase his weapons without raising red flags. In a December report, the Air Force said it failed on six occasions to report information that would have prevented Kelley from legally purchasing a gun.

Emotions run high at a memorial service held Nov. 6, 2017, at the baseball field in Sutherland Springs to honor those who were killed in a mass shooting the day before, when a gunman opened fire at a Baptist church in the small town southeast of San Antonio. (Louis DeLuca / Staff Photographer)

In addition to the lawsuit against Academy, several Sutherland Springs families have sued the federal government, saying its negligence helped Kelley carry out the shooting. The Trump administration argues the government should not be liable for these mistakes and has also placed the blame on Academy.

“The Federal Gun Control Act required Academy to comply with the laws of both Texas, the seller’s state, and Colorado, the buyer’s apparent state of residence," Paul David Stern, a Justice Department attorney, said in a filing in the suit against the federal government. “Academy was not permitted to sell Kelley the Model 8500 Ruger AR-556 under federal law because sale of that rifle would have been illegal in Colorado.”

Sheree Rumph of San Antonio prays over 26 crosses placed near U.S. Highway 87 just down the block from Sutherland Springs Baptist Church. (Louis DeLuca / Staff Photographer)

Danielle Kelley’s affidavit was provided to attorneys for the families suing Academy, her lawyer confirmed.

The rural central Texas community of Sutherland Springs will soon mark two years since the shooting. More than two dozen people, including a pregnant woman, several children and a baby, were killed in the attack, the worst in modern Texas history.