Twenty-one members of the Saudi Arabian 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 shared jihadist posts and child pornography on social media.
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”.
America’s top law official also called upon Apple to unlock two iPhones that belonged to the attacker.
The gunman fired a bullet into one phone in an effort to destroy it, Mr Barr said, but FBI investigators were able to restore it.
“We have asked Apple for their help in unlocking the shooter’s iPhones,” Mr Barr said.” So far Apple has not given us any substantive assistance.”
In the news conference, he added that initial reports that other Saudi cadets had filmed the attack as it unfolded were inaccurate.
The gunman had arrived at the scene of the shooting alone, said Mr Barr.
The attorney general said 17 of the expelled cadets were found to have shared terrorist material online.
Fifteen, including some of the 17, had shared child pornography, he added.
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.
Mr Barr also said the Kingdom of Saudi Arabia had given “complete and total” support to the inquiry.
Saudi officials had determined the cadets’ conduct was “unbecoming an officer in the Saudi Royal Air Force and Royal Navy”, said the attorney general.
He added that the expelled cadets had not been charged with any crime in the US, but might face prosecution back home.
There are more than 850 Saudi military cadets conducting training in the US.
Investigators say the attacker, Second Lt Mohammed Alshamrani, had shown videos of violence to his colleagues at a dinner party before the attack.
The 9mm handgun he used was purchased lawfully.
The Pensacola base has long offered aviation 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.