The Saudi Air Force member suspected of fatally shooting three people at a naval base in Pensacola, Florida, invited three Saudi flight students to dinner in the past week and showed them videos of mass shootings, according to law enforcement officials.

Investigators believe the three had nothing to do with Friday's attack, the officials told NBC News. No one has been arrested in the attack that also left several people wounded.

The dead were identified by the U.S. Navy late Saturday as aviation students Ensign Joshua Kaleb Watson, 23, of Coffee, Alabama; Airman Mohammed Sameh Haitham, 19, of St. Petersburg, Florida; and Airmen Apprentice Cameron Scott Walters, 21, of Richmond Hill, Georgia.

Capt. Tim Kinsella, commanding officer of Naval Air Station Pensacola, said the three took action during the attack.

"When confronted, they didn’t run from danger; they ran towards it and saved lives," he said in a statement. "If not for their actions, and the actions of the Naval Security Force that were the first responders on the scene, this incident could have been far worse."

The gunman, who was killed by sheriff's deputies, was identified by the FBI late Saturday as Mohammed Saeed Alshamrani, 21, a second lieutenant in the Royal Saudi Air Force. He was in a training program at Naval Air Station Pensacola.

The FBI asked anyone with information about Alshamrani or his activities to contact the Jacksonville bureau.

"FBI Jacksonville is not aware of any credible threat toward the Pensacola community at this time," it said in a statement.

Authorities believe a social media post critical of U.S. support for Israel and claiming America is anti-Islam belongs to Alshamrani. The post, which appeared before the shooting, is no longer live.

Law enforcement sources say investigators believe the shooter returned to Saudi Arabia after starting his U.S. training in 2017, and when he returned in February, he stopped socializing and going out as much with the three friends.

They also said that although non-citizens are normally prohibited from buying handguns, Alshamrani used a loophole to legally purchase his weapon from a dealer in Pensacola. Non-citizens with hunting licenses can buy firearms, and the shooter apparently had such a license, sources said.

After the shooting, a number of Saudi training students were led away by authorities, according to a source familiar with the matter.

Some Saudi students captured video of the attack, but law enforcement sources said Saturday there was no official concern about the filming and that multiple witnesses had made recordings.

Download the NBC News app for breaking news

Officials have not publicly discussed a possible motive.

"We are not prepared at this hour to confirm what may have motivated the shooter to commit this horrific act today," Rachel L. Rojas, FBI special agent in charge of the Jacksonville division, said Friday night.

Lt. Col. Dave Eastburn, a Pentagon spokesman, said the suspect had been scheduled to complete a three-year U.S. Air Force Foreign Military Sales training program, funded by Saudi Arabia, in August.

Foreign students from ally and "partner" nations of the U.S. have been coming to train at the base since at least World War II, Base commander Capt. Timothy Kinsella said Friday.

"There have always been international students training here because it's a good place to train. It's good-quality training," he said.

Eastburn said 5,181 foreign students from 153 countries, including 852 Saudis, are in the U.S. for Department of Defense security cooperation-related training. According to a Pentagon policy, foreign nationals who want to participate in the program are vetted for terrorist activity, drug trafficking, corruption and criminal conduct.

The shooting occurred around 6:50 a.m. in a two-floor classroom building at the naval base, which is on the Florida Panhandle about 13 miles from the Alabama border.

In addition to the three killed, eight were injured, including two Escambia County sheriff's deputies who exchanged gunfire with the shooter. One deputy has been released from the hospital, and the other was recovering from surgery.

One of the victims killed was remembered by his brother for saving the lives of others despite being shot multiple times. In a Facebook post, Adam Watson confirmed that Joshua Kaleb Watson was among those killed and said his brother told first responders where the shooter was located on the base.

Joshua Kaleb Watson.

"Today has been the worst day of my life," Adam Watson wrote. "Joshua Kaleb Watson saved countless lives today with his own. After being shot multiple times he made it outside and told the first response team where the shooter was and those details were invaluable."

Adam Watson said his brother "died a hero."

"We are beyond proud but there is a hole in our hearts that can never be filled," he wrote.

Friday's shooting is the second incident this week at a U.S. Navy facility. On Wednesday, a U.S. sailor shot and killed two civilian Defense Department employees and wounded a third at the Pearl Harbor Shipyard in Hawaii before killing himself.