The man who killed at least 26 people and wounded about 20 others at a Baptist church in Sutherland Springs, Texas, on Sunday has been identified as Devin Patrick Kelley, a 26-year-old former U.S. Air Force airman who has a history of domestic violence and who was involved in what law enforcement called a “domestic situation” with his relatives who attended the church.

Kelley, who was found dead in his car after the shooting, lived in New Braunfels, Texas, a rural San Antonio suburb 35 miles north of Sutherland Springs. Neighbors have said that he lived in a barn with his wife and his 2-year-old son on a 28-acre property owned by his parents, and a manager at a vacation resort said Kelley worked for the resort as a security guard for the past month and a half, according to the Associated Press. The gunman’s former in-laws told law enforcement that they sometimes attended First Baptist Church in Sutherland Springs, though they weren’t there on Sunday, and that Kelley had attended the church “from time to time,” according to the AP.

An area resident also told the Los Angeles Times that Kelley had been adding people he didn’t know from around Sutherland Springs, a town of 400, as friends on Facebook in recent months and “starting Facebook fights with them.”

Reporters and law enforcement have been piecing together information about the gunman’s background in an effort to understand Monday’s violence.

As with most mass shootings, the gunman had a history of domestic abuse. An Air Force official has confirmed that Kelley was court-martialed in 2012 for assaulting his spouse and their child, according to the AP. He was then sentenced to a year in military prison and was discharged in 2014. Until then, he had been serving in Logistics Readiness at Holloman Air Force Base in New Mexico since 2010, according to the AP.

Others remembered violent and disturbing behavior. Two former girlfriends told NBC News that Kelley had become violent after their breakups. One said he had assaulted her and harassed her with repeated phone calls. Another woman who said she had dated Kelley when he was 18 and she was just 13 also said she was harassed with “constant” calls, causing her to contact the police. Kelley had offered her money to hang out, the woman said, and he had said she should move in with him and his wife.

Authorities have said the gunman’s mother-in-law, who attended the church, received “threatening texts” from him, according to the AP. At a news briefing, investigators said the texts were part of a “domestic situation going on with the family and in-laws” and that the gunman had “expressed anger towards his mother-in-law,” although they could not say that the dispute was a motivation for the attack.

“This was not racially motivated, it wasn’t over religious beliefs,” authorities said.

Records indicate Kelley’s first marriage ended in 2012, and he remarried in 2014.

According to the Washington Post, in Aug. 2014, Kelley was charged with mistreating or neglecting an animal or animals in El Paso County, Colorado, where he once lived. The case was dismissed.

CNN reported that Kelley had purchased the gun he used in April 2016 from an Academy Sports & Outdoors store in San Antonio. He lied in the background-check paperwork, checking the box that indicated he didn’t have a criminal history, officials said. The AP reported he also did not have a license to carry a gun. Police said they found other weapons in his car and told CBS News they believe Kelley died from a self-inflicted gunshot wound.

Update, Monday, Nov. 6, 11:57 p.m.: This post has been updated with new information about Kelley’s gun ownership and alleged threats to his mother-in-law.

Update, Monday, Nov. 6, 12:35 p.m.: This post has been updated with new information about Kelley’s “domestic situation.”