Saudi military shooter slammed US as 'nation of evil'
The SITE Intelligence Group, which monitors jihadist media, identified him as Mohammed al-Shamrani, saying he had posted a short manifesto on Twitter that read: "I'm against evil, and America as a whole has turned into a nation of evil."
"I'm not against you for just being American, I don't hate you because your freedoms, I hate you because every day you supporting, funding and committing crimes not only against Muslims but also humanity," he wrote.
ABC News reported that investigators were working to determine if it was in fact written by the shooter.
The shooting, which took place in a classroom building at Naval Air Station Pensacola in Florida, left eight others wounded, including two sheriff's deputies who responded to the attack.
Florida Governor Ron DeSantis confirmed the shooter, who was shot dead by police, was from Saudi Arabia - the same nationality as 15 of the 19 men involved in the 9/11 attacks, some of whom attended civilian flight school in Florida.
The Twitter account that posted the manifesto - which also condemned US support for Israel and included a quote from Al-Qaeda's deceased leader, the Saudi Osama bin Laden - has been suspended.
DeSantis told a news conference that "the government of Saudi Arabia needs to make things better for these victims. And I think they are going to owe a debt here given that this is one of their individuals."
Commanding officer Captain Timothy Kinsella said the shooter was an aviation trainee, one of "a couple hundred" foreign students at the base.
Six Saudis were detained following the shooting, including three who were seen filming the entire attack, The New York Times reported, citing a person briefed on the initial investigation.
The gunman was armed with a Glock 9mm handgun that had been purchased locally, the Times reported. It had an extended magazine and the shooter had four to six other magazines in his possession.
Saudi Arabia's King Salman telephoned US President Donald Trump to denounce the shooting, affirming that "the perpetrator of this heinous crime does not represent the Saudi people," according to the official Saudi Press Agency.
Saudi Arabia has long been a major US ally in the Middle East, thanks primarily to security considerations and oil.
Trump said King Salman "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."
Police were first called about the shooting shortly before 7:00 am (1200 GMT), Escambia County Sheriff David Morgan said.
"Walking through the crime scene was like being on the set of a movie," Morgan said. "You don't expect this to happen."
Only members of the security forces can bring weapons on base, Kinsella said, and it was not clear how the shooter got the gun onto the premises.
Secretary of Defence Mark Esper said he is "considering several steps to ensure the security of our military installations and the safety of our service members and their families," but did not provide details.
Military base shootings rare
The Pensacola naval air station hosts 16,000 military personnel and more than 7,000 civilians, and is home to a flight demonstration squadron.
It is an early training centre for naval pilots, and is known as the "cradle of naval aviation."
The base is the centre for the US Navy foreign military training programs, established in 1985 specifically for Saudi students before being expanded to other nationalities.
While mass shootings in the United States are common, they are rare at military facilities.
In July 2015, Mohammad Youssuf Abdulazeez carried attacked two military installations in Tennessee that killed four Marines and a sailor. The FBI concluded the violence was inspired by a "foreign terrorist group."
Two years earlier, Aaron Alexis killed 12 people and wounded eight at the Washington Navy Yard in the US capital, before being shot dead by officers.
Four years before that, Major Nidal Hasan, a US Army psychiatrist, killed 13 people and wounded more than 30 at Fort Hood in Texas.
He was considered a "lone wolf" who supported Al-Qaeda.
Supporters of tighter gun laws seized on the latest shooting.
"Our veterans and active-duty military put their lives on the line to protect us overseas - they shouldn't have to be terrorised by gun violence at home," Cindy Martin, a volunteer with Moms Demand Action whose daughter works at the naval base, said in a statement.