(CNN) The gunman in a deadly shooting at Naval Air Station Pensacola in Florida was a second lieutenant in the Saudi Arabian military involved in flight training at the station, US Secretary of Defense Mark Esper said Friday.
Officials are looking into whether the shooting was terror-related as a possible motive, but it's still early in the investigation.
Three people were killed in the shooting and at least eight others were injured and taken to a hospital, authorities said.
Two law enforcement sources told CNN the shooter, who was killed, has been identified as Saudi Arabian national Mohammed Alshamrani.
The gunman started his training in August 2017 as part of a three-year program. He was taking classes in basic aviation, initial pilot training and English, according to a spokesperson for the assistant to the Secretary of Defense.
President Donald Trump has spoken with the King of Saudi Arabia about the shooting, he said on Twitter.
"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," the president said.
Saudi King Salman Abdulaziz Al-Saud expressed "deep sadness and sorrow" in the call, state-run SPA news reported. The king told the President that he ordered Saudi services to cooperate with the investigation, according to SPA.
At a news conference, Gov. Ron DeSantis mentioned the connection to the Saudi Air Force and said that he had spoken to Trump about it.
"There's obviously going to be a lot of questions about this individual being a foreign national, being a part of the Saudi Air Force and then to be here training on our soil," he said.
"Obviously," DeSantis added, "the government of Saudi Arabia needs to make things better for these victims."
Foreign students from "partner nations" have trained at the base to learn naval aviation for years, Commanding Officer of NAS Pensacola Capt. Tim Kinsella told reporters.
"There's always been international students training here because it's a good place to train, it's good quality training," he said. He roughly estimated that there were a couple hundred foreign students at the base.
The FBI has taken over the investigation, according to an FBI spokeswoman.
The investigation is global in scope, a law enforcement source told CNN, with agents posted in Riyadh tasked with liaising with the Saudi government to obtain background information about the shooter.
Escambia County Sheriff David Morgan told CNN's Erin Burnett that the FBI had secured the areas on base where the shooter was staying and they had recovered his laptop and cell phone.
Authorities first received a call about an active shooter at NAS Pensacola around 6:51 a.m., Morgan told reporters earlier.
The shooter used a handgun and was killed after two deputies exchanged gunfire with him.
At least eight people were injured and taken to Baptist Health Care, including one who died, said Chief Deputy Chip Simmons. The deputies who confronted the shooter also suffered gunshot wounds -- one in the arm and one in the knee. Both are expected to survive.
The shooting occurred in a classroom building, Kinsella said. The base will remain on lockdown until further notice, he said.
The names of the victims are not being released until authorities notify their families.
Walking through the scene "was like being on the set of a movie," Morgan said.
"This doesn't happen in Escambia County. It doesn't happen in Pensacola. It doesn't happen to our friends and neighbors who are members of the US Navy," Morgan said. "But it did, and it has."
The shooting comes just two days after an active duty US sailor, Gabriel Romero, killed two civilian employees and injured another before killing himself at Pearl Harbor Naval Shipyard in Hawaii. Investigators have not announced a motive for the Wednesday shooting.
Acting Secretary of the Navy Thomas B. Modly said the Navy was "struck and deeply saddened" by the recent attacks, including an incident in Little Creek, Virginia.
"These acts are crimes against all of us," Modly said. "Our prayers are with the families of the fall and the wounded.
The White House and the governor's office reached out to local authorities to offer assistance, Pensacola Mayor Grover Robinson said.
Naval Air Station Pensacola employs more than 16,000 military and 7,400 civilian personnel, according to the base's website. Many families also live there, said retired Rear Adm. John Kirby, CNN's military and diplomatic analyst, who was once stationed there.
"They love the base there," Kirby said of the sailors. "It's a great relationship between the people of Pensacola and the Navy and the base there. It's a terrific Navy town."
FBI personnel from Pensacola, Jacksonville and Mobile, Alabama, are responding to the station, an FBI spokeswoman said. Multiple agencies are cooperating on the investigation, including local law enforcement and Naval Criminal Investigative Service.