Twenty-one members of the Saudi military are being expelled from the US after a cadet carried out a mass shooting at a air base last month.
The servicemen are not accused of aiding the 21-year old Saudi Air Force lieutenant.
But US Attorney General William Barr said the cadets were found to have had jihadist material and indecent images of children in their possession.
Three sailors were killed and eight wounded in the 6 December attack.
Training for Saudi servicemen was put on hold in the US after the attack.
Mr Barr told a news conference on Monday that the shooting at Naval Air Station Pensacola had been an “act of terrorism”.
He said he had asked Apple to unlock two iPhones that belonged to the gunman, who was killed by police in the attack. The gunman fired a bullet into one phone in an effort to destroy it, Mr Barr said, but FBI investigators were able to restore the device.
The attorney general said 17 of the expelled cadets were found to have possessed online terrorist material. Fifteen, including some of the 17 who possessed online terrorist material, had indecent images of children, he added.
“While one of individuals had a significant number of images, all the rest had one of two images, in most cases posted in a chat room by some other person or received over social media,” said Mr Barr.
He said the 21 cadets were being disenrolled and returned home on Monday. The Saudi cadets, he said, had fully co-operated with FBI investigation.
The Pensacola base on US has long been a hub for training to foreign military forces. Saudi pilots started training there in 1995, alongside other personnel from Italy, Singapore and Germany.
After last month’s attack, the base’s commanding officer said that about 200 international students were enrolled in programmes there. According to its website, the base employs more than 16,000 military and 7,400 civilian personnel.