Image copyright Reuters Image caption Naval Air station Pensacola employs more than 16,000 military and 7,400 civilian personnel

Saudi Arabia's King Salman condemned a gun attack at a US naval base by a Saudi student as "barbaric", President Donald Trump said.

He tweeted that the monarch had called him to offer "sincere condolences".

The gunman, an aviation student, killed three people and injured at least eight at the base in Pensacola, Florida, before being shot dead.

Florida Governor Ron DeSantis said the Saudi government was "going to owe a debt" to the victims.

The attacker has been named by US media as Mohammed Saeed Alshamrani. He used a handgun during the shooting.

The FBI are yet to declare a motive but are believed to be investigating for links to terrorism.

"There are many reports circulating, but the FBI deals only in facts," special agent Rachel Rojas told a news conference on Friday night.

Saudi Arabia is a key US ally in the Middle East and the two countries have longstanding military exchange programmes. The shooting has already prompted questions about the vetting of foreign military personnel sent to the US for training.

It is the second shooting to take place at a US military base this week.

A US sailor shot dead two workers at the Pearl Harbor military base in Hawaii on Wednesday.

What has Saudi Arabia said?

"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," President Trump tweeted.

"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."

In a separate statement, the Saudi foreign ministry called the attack "horrific" and said it would provide "full support" to the investigation.

President Trump has maintained close relations with Saudi leaders despite the killing of prominent Saudi journalist Jamal Khashoggi, who wrote a column for the Washington Post newspaper, in the country's consulate in Turkey in October 2018.

Saudi officials have said Khashoggi, a high-profile critic of the government in Riyadh, was killed in a "rogue operation" by a team of agents. But many critics believe otherwise and a UN expert concluded that the death was an "extrajudicial execution".

How did the attack in Pensacola unfold?

Authorities were alerted to the shooting in a classroom at the base on the waterfront south-west of Pensacola at 06:51 local time (12:51 GMT) on Friday.

Image copyright Reuters Image caption The Pensacola base was in lockdown after the attack

The assault ended when a sheriff's deputy shot dead the attacker. Two officers were shot in the limbs but are expected to recover.

"Walking through the crime scene was like being on the set of a movie," said Escambia County Sheriff David Morgan.

According to its website, Naval Air Station Pensacola employs more than 16,000 military and 7,400 civilian personnel.

Who was the attacker?

Mohammed Saeed Alshamrani was a second lieutenant in the Saudi Air Force in training at the site, US officials say. There are reports that he posted an online manifesto before the attack but this is yet to be confirmed.

Several Saudi nationals were detained near the scene of the shooting, the New York Times reported, citing unnamed sources.

According to the US Navy, there had in recent weeks been 18 Saudi naval aviators and two aircrew members training at Pensacola.

An investigation was taking place and names of victims would not be released until next of kin had been notified, it said in a statement.

What has the reaction been?

"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," said Gov DeSantis.

"Obviously the government of Saudi Arabia needs to make things better for these victims and I think they're going to owe a debt here, given that this was one of their individuals," he added.

Media playback is unsupported on your device Media caption Florida governor: 'The Saudi government will owe a debt here'

Senator Rick Scott, the ex-governor of Florida, called for a review of training programmes for foreign military personnel on US soil.

"We shouldn't be providing military training to people who wish us harm," he said.

The US defence secretary, Mark Esper, said he wanted to make sure that vetting was adequate.

"I want to make sure that we're doing our due diligence to understand: What are our procedures? Is it sufficient?" he told reporters.

Meanwhile Saudi officials have continued to condemn the attack, including vice-minister of defence, Khalid bin Salman, who said he trained at a US base like many others in the Saudi military.

Timothy Kinsella, the base commanding officer, earlier said he was "absolutely in awe" of the response to the attack.

"There was some real heroism today," he said. "I'm devastated. We are in shock. This is surreal, but I couldn't be prouder to wear the uniform that I wear because of my brothers and sisters in uniform, civilian or otherwise, that did what they did today to save lives."