A Saudi Arabian Air Force officer carried out a mass shooting at a US Naval base in Florida, defence officials said.
Lieutenant Mohammed Saeed Alshamrani, who was undergoing aviation training at the base, killed three people, and injured at least half a dozen more, before being shot dead by police.
According to the SITE Intelligence Group, which monitors jihadist media, Alshamrani 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."
FBI agents were investigating if the attack was terrorism-related.
The shooting happened at the Naval Air Station Pensacola, which is home to the Blue Angels, the US Navy’s aerobatic flight demonstration squadron.
Gunfire erupted in a two-floor building which houses training classrooms just before 7am.
Military members from around the world attend the base for training.
A total of 16,000 military personnel and 7,400 civilians work at the base.
The shooting happened in two-floor building housing classrooms, and the gunfire started just before 7am.
Local sheriff David Morgan said: "Walking through the crime scene was like being on the set of a movie."
Two sheriff’s deputies were injured, one shot in the arm, the other in the knee, but both were expected to survive.
Donald Trump was briefed on the shooting and monitoring the situation, a White House spokesman said.
Grover Robinson, mayor of Pensacola, said it was a "tragic day". He added: "We are a military town."
The Florida governor, Ron DeSantis, flew to the scene.
Captain Timothy Kinsella Jr., the base’s commanding officer said the base was closed until further notice.
The shooting was the second to take place at a US naval base this week.
On Wednesday, a sailor shot dead two civilians at the Pearl Harbor base in Hawaii, before taking his own life.
The gunman, petty officer Gabriel Romero, 22, had been unhappy with his commanders, and had been undergoing counseling, a US military official said.
He used his service rifle to carry out the attack before turning his service pistol on himself.
Romero was part of the crew of the submarine USS Columbia, which was undergoing maintenance at Pearl Harbor.
The shooting happened days before a ceremony on Saturday to remember those lost in the Japanese attack on Pearl Harbor 78 years ago.
#BREAKING: We are aware of reports of a possible active shooter at Naval Air Station Pensacola. More information to follow.
— (@USNavy)Dec 06 2019
Vice President Mike Pence saying he was "saddened" to hear of the incident in Pensacola.
"Saddened to hear of the horrible shooting at Naval Air Station Pensacola & continuing to monitor the situation," he wrote on Twitter.
"Praying for the victims and their families and we commend the first responders for their swift action in taking down the shooter and getting those on base to safety."
In July 2015, Mohammad Youssuf Abdulazeez carried out an attack at two military installations in the state of Tennessee that killed four Marines and a sailor, with the FBI concluding that the violence was inspired by a "foreign terrorist group."
Two years earlier, Aaron Alexis killed 12 people and wounded eight others at the Washington Navy Yard, two miles from the US Capitol building, 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 others at Fort Hood.
He was considered a "lone wolf" who supported terror network Al-Qaeda.