Four people, including the gunman, killed in shooting at Naval Air Station Pensacola in Florida, the US Navy says.

A Saudi national visiting the United States for military training was the suspect in a shooting attack at a US Navy base in Florida, which left four people dead, including the gunman, US officials said on Friday.

The attacker was killed by sheriff’s deputies responding to the dawn incident at Naval Air Station Pensacola, the Navy and local sheriff’s office said, the second deadly shooting at a US military installation this week.

Florida Governor Ron DeSantis said the suspect was a Saudi national attending training at the base as part of long-standing Navy programme open to US allies. The motive for the violence was under investigation.

“There is 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,” DeSantis said at a news conference. “The government of Saudi Arabia needs to make things better for these victims. They are going to owe a debt here, given that this was one of their individuals.”

The gunman opened fire in a classroom on Friday morning, officials said.

Twelve people were injured, including two sheriff’s deputies who were the first to respond, one of whom killed the shooter, Escambia County Sheriff David Morgan said.

#UPDATE: Shooter and three victims confirmed deceased with multiple others injured and being treated at local hospitals. NAS Pensacola remains in lockdown. Full Press Release: https://t.co/KJdL3SLPvO — U.S. Navy (@USNavy) December 6, 2019

US President Donald Trump said he has been briefed on the incident, tweeting that his “thoughts and prayers are with the victims and their families during this difficult time”.

Trump said he had received a phone call from Saudi King Salman who told him 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 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

In a statement, the Saudi embassy in Washington, DC, said King Salman expressed his “sorrow and grief” over the shooting and ordered his security services to cooperate with US authorities in investigating the shooting.

“His Majesty affirmed that the perpetrator of this heinous crime does not represent the Saudi people, who count the American people as friends and allies,” the statement said.

‘Like being on a movie set’

The suspect used a handgun in the shooting, which took place over two floors in a classroom building at a base whose main function is training, officials said.

“Walking through the crime scene was like being on the set of a movie,” Sheriff David Morgan said.

The first reports of an “active shooter” on the base came through to the Escambia County sheriff’s office at about 6:51am, officials said.

A few minutes later, a sheriff’s deputy fatally shot the attacker in a classroom on the base, Morgan added.

The Pensacola base, which is near Florida’s border with Alabama, is a major training site for the Navy and home to its aerobatic flight demonstration squadron, the Blue Angels. The base employs about 16,000 military and 7,400 civilian personnel, according to the base’s website.

The main gate at Naval Air Station Pensacola is seen on Navy Boulevard in Pensacola, Florida [Handout/Patrick Nichols/US Navy/Reuters]

Military personnel from around the globe visit the base for flight training.

In recent weeks, 18 naval aviators and two aircrew members from the Royal Saudi Naval Forces were training with the US Navy, including a stint at Pensacola, according to a November 15 press release from the Navy. It was not clear if the suspected shooter was part of that delegation.

The delegation came under a Navy programme that offers training to US allies, known as the Naval Education and Training Security Assistance Field Activity.

A person familiar with the programme said that Saudi Air Force officers selected for military training in the US are intensely vetted by both countries.

The Saudi personnel are “hand-picked” by their military and often come from elite families, the person said, speaking to Reuters News Agency on condition of anonymity because they did not have permission to speak to a reporter. Trainees must speak excellent English, the person said.

Past shootings at US military bases

Although military bases house the country’s most powerful armaments, military personnel normally are restricted from carrying weapons on base unless they are part of their daily duties. Nonetheless, US military bases have seen deadly mass shootings before, including one in Ford Hood, Texas, in 2009 that left 13 dead and one at the Washington Navy Yard in 2013 that killed 12.

On Wednesday, a sailor shot three civilians at the historic Pearl Harbor military base in Hawaii, killing two of them before taking his own life.

Pensacola Mayor Grover Robinson told reporters the base is “an incredibly important part of our community”.

“We’re a military town,” he said. “Our hearts and prayers are connected to all of those that serve us every day.”