Six Saudi nationals were detained for questioning Friday near a naval air station in Pensacola, Fla., after a Saudi gunman opened fire there, killing three people before being shot dead by officers, a senior U.S. official told Fox News.

The FBI, which is leading the investigation into the shooting -- which took place Friday morning at Naval Air Station (NAS) Pensacola in Florida -- declined to reveal the identity of the shooter in the early stages of the investigation, but a U.S. official told Fox News the gunman was an aviation student from Saudi Arabia named Mohammed Saeed Alshamrani.

NAVAL AIR STATION PENSACOLA SHOOTER WAS SAUDI AVIATION STUDENT, INVESTIGATORS EYE POTENTIAL TERROR LINK

Alshamrani was said to be a student in a U.S. Navy training program for foreign military personnel.

That program is aimed at "immersing international students in our U.S. Navy training and culture" to help "build partnership capacity for both the present and for the years ahead," Cmdr. Bill Gibson, the center’s officer in charge, said in 2017. "These relationships are truly a win-win for everyone involved."

But Friday's events caused many officials and lawmakers to call for deeper scrutiny of the security measures and vetting that goes into selecting trainees.

Sen. Rick Scott, R-Fla., wrote on Twitter that he is calling for a "full review" of the Navy training programs after investigators said they were exploring the possibility that the attack is related to terrorism.

"I'm very concerned that the shooter in Pensacola was a foreign national training on a U.S. base. Today, I'm calling for a full review of the U.S. military programs to train foreign nationals on American soil. We shouldn't be providing military training to people who wish us harm," Scott wrote.

U.S. Sen. Marco Rubio, R-Fla., wrote on Twitter that Friday's events "exposed some serious flaw" in the vetting process that trainees undergo before entering the program.

Defense Secretary Mark Esper told reporters Friday that his first priority is supporting the ongoing investigation and determining the shooter's motives.

"I want to make sure we’re doing our due diligence to understand what are our procedures" concerning the training programs, he added.

Esper referred to the shooter as a Saudi national who was a second lieutenant in flight training.

Sources told Fox News that the scene of the shooting -- a classroom, where students usually spend three months at the beginning of the program -- indicated that the shooter was a student who was “early” in his training.

The majority of the hundreds of foreign aviation students who have participated in the program are from Saudi Arabia, the Navy said. The Naval training program has about 1,500 pilots in total.

Saudis have received training at the Pensacola site since the 1970s, with as many as 20 students from the Middle Eastern country in any given class, sources told Fox News. Many of the students are often from the Royal Family, putting pressure on officials to pass pilots through the training program in an attempt to preserve diplomacy with the U.S. ally.

Many U.S. military pilots have complained for decades that some of the Saudi pilots are not safe flyers, sources said.

Security at the base had been beefed up over the last five years and the addition of a front gate barred access to civilians from neighboring Pensacola. It would take civilians about 45 minutes to get through security at the front gate but not every car is always checked, sources said.

“The government of Saudi Arabia needs to make things better for these victims," Florida Gov. Ron DeSantis, who said he had spoken to President Trump about the shooting, told reporters during a news conference Friday afternoon. "They are going to owe a debt here given that this is one of their individuals.”

The Saudi Arabian Ministry of Foreign Affairs expressed "its deep distress" following the shooting and offered "its sincere condolences to the victims' families, and wishes the injured a speedy recovery," it said in a statement on Friday.

"The perpetrator of this horrific attack does not represent the Saudi people whatsoever. The American people are held in the highest regard by the Saudi people," the ministry said."Building upon the strong ties between the Kingdom of Saudi Arabia and the United States of America, and in continuation of the ongoing cooperation between the two countries’ security agencies, the Saudi security agencies will provide full support to the US authorities to investigate the circumstances of this crime.​"

President Trump also said that he spoke to King Salman of Saudi Arabia after the shooting and that the foreign leader "called to express his sincere condolences and give his sympathies to the families and friends of the warriors who were killed and wounded in the attack that took place in Pensacola, Florida."

CLICK HERE FOR THE FOX NEWS APP

“The King said that the Saudi people are greatly angered by the barbaric actions of the shooter, and that this person in no way shape or form represents the feelings of the Saudi people who love the American people,” Trump added.