The US will send home 21 Saudi military trainees after an investigation into the “jihadist” killing of three US sailors last month, the Department of Justice announced on Monday.

Attorney General Bill Barr said the December 6 shootings by Royal Saudi Air Force 2nd Lieutenant Mohammed Saeed Alshamrani at the US Naval Air Station in Pensacola, Florida was an “act of terrorism”.

“The evidence shows that the shooter was motivated by jihadist ideology,” he told reporters.

There was no evidence that Alshamrani had colluded with others, although Barr said FBI investigators had been unable to unlock his two phones to determine whom he had contacted.

“We have asked Apple for their help in unlocking the shooter’s iPhones. So far Apple has not given us any substantive assistance,” Barr said.

The attorney general said 21 of Alshamrani’s colleagues were being expelled from the base’s flight school after the probe found many of them had jihadist material and child porn.

While the material didn’t rise to the level of criminal prosecution, Barr said Riyadh had “determined that this material demonstrated conduct unbecoming to an officer in the Saudi Royal Air Force and Royal Navy and the 21 cadets have been dis-enrolled from their training curriculum”.

They were to return to Saudi Arabia later on Monday, Barr said.

He added that the Saudi government had vowed to review each case under its code of military justice and criminal code.

“Further, the kingdom has assured us that, if we later decide to charge any of those being sent back to Saudi Arabia in connection with this counterterrorism investigation, it will return them for trial,” Barr said.

Alshamrani gunned down three US sailors and wounded eight other people in a classroom block, in what Barr described as a premeditated assault before police shot the gunman dead.

He had posted a message on social media on September 11 last year, saying “the countdown has begun”, in addition to several other anti-US, anti-Israel and jihadist messages, the investigation revealed.

The shooting threatened a decades-old military training programme crucial to the US-Saudi relationship, which involves billions of dollars of military sales to the kingdom.

There are around 850 Saudis among the 5,000 foreign military personnel undergoing training in the US.

Many, such as the Saudis in Pensacola, are trained in flying and maintenance of US-made military aircraft their countries are purchasing.

“These military partnerships are critically important to our country,” Barr said.