Washington: At least 26 persons were killed when a lone gunman carrying a military-style rifle opened fire on worshippers at a Baptist church in Texas in one of the deadliest mass shooting in the US state’s history. The killer himself died later.

The attack took place on Sunday morning in Sutherland Springs, a small town some 45 km southeast of San Antonio city. Investigators on Monday scoured the background of the gunman, Devin Patrick Kelley, searching for answers on a possible motive, the US media reported.

Kelley started firing at the First Baptist Church shortly after the morning service began at 11, the police said. He was armed with a Ruger AR-556 rifle, and within minutes, many of those inside the small church were dead or injured.

The gunman — described as a former member of the Air Force — fired upon the services before he came under fire from a local man. As the killer escaped in a car, the other man chased him, firing away. The attacker eventually ran off the roadway and apparently took his own life.

Freeman Martin of the Texas Department of Public Safety told the Washington Post: “We don’t know if it was a self-inflicted gunshot wound or if he was shot by our local resident who engaged him in a gunfight.”

The motive for the attack remains unknown. At least 20 persons were injured in the attack.

The victims ranged between the age of five and 72 years and included at least eight members of a family, a pregnant woman and three of her children along with the 14-year-old daughter of the church’s pastor, Martin added.

Kelley, 26, was court-martialled in 2012 and sentenced to a year in military prison for assaulting his spouse and child, making him the latest mass attacker or suspect with domestic violence in his past.

He served a year in confinement. He was reduced in rank and released with a bad-conduct discharge in 2014.

Over 100 residents of Sutherland Springs town held a moment’s silence on Sunday night. A candlelight vigil was also held.

Among those present was Texas Governor Greg Abbott, who hours earlier had called the attack the “largest mass shooting in our state’s history”.

President Donald Trump said on Monday in Tokyo that guns were not to blame for the shooting.

“We have a lot of mental health problems in our country, but this isn’t a guns situation,” he said.

“Based on preliminary reports,” he said, the shooter was “a very deranged individual, a lot of problems for a long period of time”.

Trump did not provide the basis for his statement, saying “it’s a little bit soon to go into it.

“This isn’t a guns situation… Fortunately someone else had a gun that was shooting in the opposite direction” or it “would have been much worse”.

Sunday’s massacre unfolded on the eighth anniversary of the attack in 2009 on Fort Hood in Texas when an Army psychiatrist, Major Nidal Malik Hasan, killed 13 people in one of the deadliest mass shootings at an American military base.