WASHINGTON | The U.S. sent home 21 Saudi military students following an investigation into a deadly shooting last month by one of their fellow trainees at the Pensacola Naval Air Station, an attack that Attorney General William Barr said was an act of terrorism driven by some of the same motivations of the Sept. 11 plot.

The trainees who were removed had jihadist or anti-American sentiments on social media pages or had “contact with child pornography,” including in internet chat rooms, officials said. None is accused of having had advance knowledge of the shooting or helped the 21-year-old gunman carry it out.

The Justice Department reviewed whether any of the trainees should face charges, but concluded that the conduct did not meet the standards for federal prosecution, Barr said.

The Dec. 6 shooting at the base in Pensacola in which Saudi Air Force officer Mohammed Alshamrani killed three U.S. sailors and injured eight other people focused public attention on the presence of foreign students in American military training programs and exposed shortcomings in the screening of cadets. Monday’s resolution singled out misconduct by individual students but also allows for continued training of pilots from Saudi Arabia, an important ally in the Middle East.

“The Kingdom of Saudi Arabia gave complete and total support for our counter-terrorism investigation, and ordered all Saudi trainees to fully cooperate,” Barr said. “This assistance was critical to helping the FBI determine whether anyone assisted the shooter in the attack.”