A man dressed in black tactical-style gear and armed with an assault rifle opened fire inside a church in a small South Texas community on Sunday, killing 26 people and wounding about 20 in what the governor called the deadliest mass shooting in the state's history. The dead ranged in age from 5 to 72 years old.

Authorities didn't identify the attacker during a news conference Sunday night, but two other officials — one a U.S. official and one in law enforcement — identified him as Devin Kelley. They spoke to The Associated Press on the condition of anonymity because they weren't authorized to discuss the investigation.

The U.S. official said Kelley lived in a San Antonio suburb and didn't appear to be linked to organized terrorist groups. Investigators were looking at social media posts Kelley made in the days before Sunday's attack, including one that appeared to show an AR-15 semiautomatic weapon.

Kelley received a bad-conduct discharge from the U.S. Air Force for allegedly assaulting his spouse and child, and was sentenced to 12 months' confinement after a 2012 court-martial. Kelley served in Logistics Readiness at Holloman Air Force Base in New Mexico from 2010 until his discharge, Air Force spokesperson Ann Stefanek said.

At the news conference, the attacker was described only as a white man in his 20s who was wearing black tactical gear and a ballistic vest when he pulled into a gas station across from the First Baptist Church around 11:20 a.m. local time.

The gunman crossed the street and started firing a Ruger AR rifle at the church, said Freeman Martin, a regional director of the Texas Department of Safety, then continued firing after entering the white wood-frame building, where an 11 a.m. service was scheduled.

'Defenceless people'

Wilson County Sheriff Joe D. Tackitt Jr., whose territory includes Sutherland Springs, said there was likely "no way" for the church congregation to escape once the shooting started.

"You've got your pews on either side. He just walked down the centre aisle, turned around and my understanding was shooting on his way back out," said Tackitt, who said the shooter also carried a handgun but that he didn't know if it was fired.

Wilson County Sheriff Joe Tackitt, Jr. talks to media outside of the First Baptist Church. Tackitt said "it's unbelievable to see children, men and women, laying there." (Laura Skelding/Associated Press)

Tackitt described the scene inside the church as "terrible."

"It's unbelievable to see children, men and women, laying there. Defenceless people," Tackitt said. "I guess it was seeing the children that were killed. It's one thing to see an adult, but to see a 5-year-old..."

No motive yet

As he left, the shooter was confronted by an armed resident who "grabbed his rifle and engaged that suspect," Martin said. A short time later, the suspect was found dead in his vehicle at the county line.

Several weapons were found inside the vehicle and Martin said it was unclear if the attacker died of a self-inflicted wound or if he was shot by the resident who confronted him. He said investigators weren't ready to discuss a possible motive. Martin said 23 of the dead were found in the church, two were found outside and one died after being taken to a hospital.

A parishioner of the First Baptist Church reacts after a man opened fire inside the small Texas church 2:48

The man who confronted the shooter had help from another local resident, Johnnie Langendorff, who told KSAT TV that he was driving past the church as the shooting happened. He didn't identify the armed resident but said the man exchanged gunfire with the gunman, then asked to get in Langendorff's truck and the pair pursued as the gunman drove away.

Langendorff says the gunman eventually lost control of his vehicle and crashed. He says the other man walked up to the vehicle with his gun drawn and the suspect did not move. He stayed there for at least five minutes, until police arrived.

"I was strictly just acting on what's the right thing to do," Langendorff said.

'Pure evil'

Gov. Greg Abbott called the attack the worst mass shooting in Texas history.

"There are no words to describe the pure evil that we witnessed in Sutherland Springs today," Abbott said. "Our hearts are heavy at the anguish in this small town, but in time of tragedy, we see the very best of Texas. May God comfort those who've lost a loved one, and may God heal the hurt in our communities."

Among those killed was the church pastor's 14-year-old daughter, Annabelle Pomeroy. Pastor Frank Pomeroy, and his wife, Sherri, were both out of town in two different states when the attack occurred, Sherri Pomeroy wrote in a text message to the AP.

"We lost our 14-year-old daughter today and many friends," she wrote. "Neither of us has made it back into town yet to personally see the devastation. I am at the charlotte airport trying to get home as soon as i can."

'Everybody's going to be affected'

Federal agents swarmed the small rural community of a few hundred residents, including ATF investigators and members of the FBI's evidence collection team.

Alena Berlanga, a resident of nearby Floresville, known for its annual peanut festival, said everyone knows everyone else in the sparsely populated county.

"Everybody's going to be affected and everybody knows someone who's affected," Berlanga said.

Church member Nick Uhlig, 34, wasn't at Sunday's service, but he said his cousins were at the church and that his family was told at least one of them, a woman with three children and pregnant with another, was among the dead.

"We just gathered to bury their grandfather on Thursday," he said, shaking his head.

'Senseless and horrific'

U.S. President Donald Trump, who was in Japan, called the shooting an "act of evil" and said he was monitoring the situation.

Prime Minister Justin Trudeau said in a statement he was "saddened that so many have been killed and injured in a senseless and horrific act of violence."

Canadians send their condolences to those affected by today's tragic church shooting in Texas - we wish a full recovery to the injured. —@JustinTrudeau

The church has posted videos of its Sunday services on a YouTube channel, raising the possibility that the shooting was captured on video.

In a video of its Oct. 8 service, a congregant who spoke and read Scripture pointed to the Oct. 1 Las Vegas shooting a week earlier as evidence of the "wicked nature" of man. That shooting left 58 dead and more than 500 injured.

Until Sunday, the deadliest mass shooting in Texas had been a 1991 attack in Killeen, when a mentally disturbed man crashed his pickup truck through a restaurant window at lunchtime and started shooting people, killing 23 and injuring more than 20 others.

The University of Texas was the site of one of the most infamous mass shootings in American history, when U.S. Marine sniper Charles Whitman climbed the Austin campus' clock tower in 1966 and began firing on stunned people below, killing 13 and wounding nearly three dozen others. He had killed his wife and mother before heading to the tower, one victim died a week later and medical examiners eventually attributed a 17th death to Whitman in 2001.