Police said eight other people, including two police deputies, were injured, but the extent of those injuries is unclear. Law enforcement officials briefed on the case identified the shooter to ABC News as Mohammed Alshamrani.
Police said the shooting happened around 6:30 a.m. ET Friday at the Navy base, located on Florida's Gulf Coast. The suspect was armed with a handgun, according to Escambia County Sheriff David Morgan. Weapons are not authorized on base, Capt. Timothy Kinsella added.
Armed with a semi-automatic handgun with an extended magazine, the shooter opened fire in a classroom building on Friday morning. He was apparently firing at random and at one point was slowed when somebody barricaded a door, allowing others to flee out of the building. The two sheriff's deputies who were the first to respond, including one who killed the shooter, were wounded but expected to recover.
ABC News Special Report
Sources told ABC News that investigators are working to determine if the shooter was acting out because of religious or ideological reasons or if there was some sort of problem or hostility that developed in the course of the training at Pensacola.
Investigators have found what purports to be an online screed written by the shooter and are working to determine if it is legitimate. In it, the writer expresses hatred toward Americans because of crimes against Muslims and humanity as well as US support for Israel.
In a press conference, Florida Gov. Ron DeSantis implored the Saudi government to "make things better for these victims," saying: "I think they're going to owe a debt here given that this is one of their individuals."
President Donald Trump said on Twitter that King Salman bin Abdul-Aziz Al Saud Salman of Saudi Arabia had called "to express his sincere condolences and give his sympathies to the families and friends of the warriors who were killed and wounded."
"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 tweeted.
King Salman of Saudi Arabia just 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....— Donald J. Trump (@realDonaldTrump) December 6, 2019
....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.— Donald J. Trump (@realDonaldTrump) December 6, 2019
Vice Minister of Defense Khalid bin Salman noted on Twitter that he and many Saudi military personnel have trained on U.S. military bases and gone on to fight ''against terrorism and other threats'' alongside American forces. "Today's tragic event is strongly condemned by everyone in Saudi Arabia,'' he said.
A national security expert from the Heritage Foundation warned against making an immediate link to terrorism.
"If there is some connection to terrorism, well, then, that's that," Charles "Cully" Stimson said. "But let's not assume that because he was a Saudi national in their air force and he murdered our people, that he is a terrorist."
Stimson said it was also possible that the shooter was "a disgruntled evil individual who was mad because he wasn't going to get his pilot wings, or he wasn't getting the qualification ratings that he wanted, or he had a beef with somebody, or there was a girlfriend involved who slighted him."
Florida U.S. Sen. Rick Scott issued a scathing statement calling the shooting an act of terrorism "whether this individual was motivated by radical Islam or was simply mentally unstable."
Scott added that it was "clear that we need to take steps to ensure that any and all foreign nationals are scrutinized and vetted extensively before being embedded with our American men and women in uniform."
U.S. Defense Secretary Mark Esper said in a statement Friday that he was "considering several steps to ensure the security of our military installations and the safety of our service members and their families." He did not elaborate.
The U.S. has long had a robust training program for Saudis, providing assistance in the U.S. and in the kingdom. The shooting, however, shined a spotlight on the two countries' sometimes rocky relationship.
The kingdom is still trying to recover from the killing last year of Washington Post columnist Jamal Khashoggi at the Saudi Consulate in Istanbul. Saudi intelligence officials and a forensic doctor killed and dismembered Khashoggi on Oct. 2, 2018, just as his fiancée waited outside the diplomatic mission.
One of the Navy's most historic and storied bases, Naval Air Station Pensacola sprawls along the waterfront southwest of the city's downtown and dominates the economy of the surrounding area.
Part of the base resembles a college campus, with buildings where 60,000 members of the Navy, Marines, Air Force and Coast Guard train each year in multiple fields of aviation. A couple hundred students from countries outside the U.S. are also enrolled in training, said Base commander Capt. Tim Kinsella.
The base is also home to the Blue Angels flight demonstration team, and includes the National Naval Aviation Museum, a popular regional tourist attraction.
Lucy Samford, 31, said her husband, a Navy reservist and civilian worker on the base, was about 500 yards (0.46 kilometers) from where the shooting happened. She said she got a call from him a little after 7 a.m. and "one of the first things out of his mouth was, 'I love you. Tell the kids I love them. I just want you to know there's an active shooter on base.'"
Her husband, whom she declined to identify, later told her he was OK.
All of the shooting took place in one classroom and the shooter used a handgun, authorities said. Weapons are not allowed on the base, which Kinsella said would remain closed until further notice.
The shooting is the second at a U.S. naval base this week. A sailor whose submarine was docked at Pearl Harbor, Hawaii, opened fire on three civilian employees Wednesday, killing two before taking his own life.
The Associated Press contributed to this report.