President Trump called the mass shooting at a Texas church on Sunday a "mental health problem at the highest level," and said the gunman was a "deranged" individual.

Officials have said 26-year-old Devin Patrick Kelley opened fire inside the First Baptist Church in Sutherland Springs, killing 26 people and wounding 20 others. Kelley was found dead inside his vehicle after being pursued by local residents.

Texas Gov. Greg Abbott called the attack the deadliest mass shooting in his state's history. Officials said 23 people were found dead inside the church, two outside, and one died after being taken to a hospital.

Texas Rangers are leading the investigation, with significant support from the FBI. Law enforcement officials have yet to speculate on the motive in the attack.

Get Breaking News Delivered to Your Inbox

Speaking in Japan early Monday morning, however, Mr. Trump said: "I think that mental health is the problem here. This was a very -- based on preliminary reports -- very deranged individual, a lot of problems over a long period of time. We have a lot of mental health problems in our country, as do other countries."

"But, this isn't a guns situation, we could go into it, but it's a little soon to go into it," said Mr. Trump.

"Fortunately somebody else had a gun that was shooting in the opposite direction," said Mr. Trump, speaking alongside the Japanese Prime Minister on the first stop of an extended Asia trip. "Otherwise it would've been -- as bad as it was -- it would've been much worse. But, this is a mental health problem at the highest level."

It was not immediately clear what information Mr. Trump had about the shooting suspect from his private briefings that lead him to attribute the attack to mental health issues.

Kelley served in the U.S. Air Force from 2010 to 2014. Records confirm he served at Holloman Air Force Base in New Mexico until his discharge for bad conduct in 2014, Air Force spokesperson Ann Stefanek said in a statement. Stefanek said prior to his discharge, Kelley was court-martialed in 2012 for two counts of assault on his spouse and their child.

On Sunday night, authorities only identified the suspect as a young white male. They said he was seen dressed in all black with tactical gear -- including a "ballistic vest" -- at a local gas station at 11:20 a.m. He then exited his vehicle, crossed the street and began firing an AR-15 style weapon at the church, officials said. The suspect entered the church and continued to fire.

President Trump speaks during a news conference with Shinzo Abe, Japan's prime minister, not pictured, at Akasaka Palace in Tokyo, Japan, Nov. 6, 2017. Reuters

In his first remarks on the shooting, at an earlier appearance with Abe after arriving in Japan, Mr. Trump called it an "act of evil."

"Victims and their families were in their sacred place of worship ... we cannot put into words the pain and grief we all feel," Mr. Trump said. "In dark times such as these, Americans do we what do best and we pull together. We lock hands and we join arms. Through the tears and through the sadness we stand strong."

Mr. Trump pledged his full support to the state of Texas and the local communities affected by Sunday's attack, and he ordered flags on U.S. government buildings to fly at half-staff out of respect for the victims of the shooting.

"We offer our thanks to the first responders, to the FBI, all of the many people involved. I will continue to follow the developments closely. All of America is praying to God," Mr. Trump said.

The president vowed to his supporters during the campaign in 2016 to protect their gun rights if he was elected. In April this year, he touted his success in doing so at a National Rifle Association (NRA) conference in Atlanta, including landing the "very special" and pro-Second Amendment Neil Gorsuch on the U.S. Supreme Court.

Mr. Trump emphasized his support of "responsible" gun ownership.

"You have a true friend and champion in the White House," said Mr. Trump. "No longer will federal agencies be coming after law-abiding gun owners. No longer will the government be trying to undermine your rights and your freedoms as Americans."

The president has made it clear for some time that he believes the way to tackle mass shootings in the U.S. is by better addressing mental health problems, not tighter laws on firearms.

After a gunman opened fire in a Lafayette, Louisiana movie theater in July 2016, killing two people and injuring nine others, then-candidate Donald Trump pushed back against the renewed calls to strengthen gun control legislation.

"These are sick people," Mr. Trump said of the shooter, John Russell Houser, who was reportedly mentally ill. "This has nothing to do with guns. This has to do with the mentality of these people."

"I'm a big Second Amendment person. You need protection," he added in a CNN interview. "This person from what I hear had a record of mental instability. If it's proven and documented you have to be careful to not let them kill people. He had the kind of record where he should be in an institution."