President Trump on Monday said the mass shooting at a Texas church is the result of a "mental health problem at the highest level" and called the gunman a “very deranged individual.”

Trump was at an event with Japan’s Prime Minister Shinzo Abe in Tokyo and responded to questions about the shooting Sunday at a Texas church that killed at least 26 and wounded 20.

“This isn’t a guns situation,” Trump said. “This is a mental health problem at the highest level. It’s a very, very sad event.”

Authorities on Monday were working to determine a motive in the shooting that occured at around 11:30 a.m. at First Baptist Church of Sutherland Springs, which is about 30 miles southeast of San Antonio.

Multiple sources told Fox News the gunman was 26-year-old Devin Patrick Kelley.

Kelley lived in a suburb of San Antonio and didn't appear to be linked to organized terrorist groups, a U.S. official told The Associated Press. The official said investigators were looking at social media posts Kelley may have made in the days before Sunday's attack, including one that appeared to show a semiautomatic weapon.

Authorities said the gunman wore black tactical gear and a ballistic vest when he pulled into a gas station across from the church. He 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.

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 center 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.

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

"It's unbelievable to see children, men and women, laying there. Defenseless 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 ..."

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.

The man who confronted Kelley had help from another local resident, Johnnie Langendorff, who told KSAT TV that he was driving past the church as the shooting happened.

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

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

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 when the attack occurred, Sherri Pomeroy wrote in a text message.

"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."

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

Later Sunday, two sheriff's vans were parked outside the gate of a cattle fence surrounding the address listed for Kelley on the rural, western outskirts of New Braunfels, north of San Antonio.

Ryan Albers, 16, who lives across the road, said he heard intensifying gunfire coming from that direction in recent days.

"It was definitely not just a shotgun or someone hunting," Albers said. "It was someone using automatic weapon fire."

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

The Associated Press contributed to this report