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."
Barr said the kingdom has agreed to review the conduct of all 21 to see if they should face military discipline and to send back anyone the U.S. later determines should face charges.
Separately, the attorney general on Monday asked Apple to help extract data from two iPhones that belonged to the gunman, including one that authorities say Alshamrani damaged with a bullet after being confronted by law enforcement.
Law enforcement officials left no doubt that Alshamrani was motivated by jihadist ideology, saying he visited a New York City memorial to the attacks of Sept. 11, 2001, over the Thanksgiving holiday weekend and posted anti-American and anti-Israeli messages on social media just two hours before the shooting. Last Sept. 11, Barr said, Alshamrani posted a message that said "the countdown has started."
Officials had earlier said that Alshamrani hosted a party before the shooting, where he and others watched videos of mass shootings. Alshamrani, who also traveled back and forth between Saudi Arabia and the U.S., was undergoing flight training at Pensacola, where foreign military members routinely receive instruction.
On the morning of Dec. 6, the gunman walked into a building on the grounds of the Navy base and shot his victims "in cold blood" as Marines who heard the gunfire from outside yanked a fire extinguisher off the wall and rushed to confront him. He was ultimately killed by a sheriff's deputy during the rampage.
The gunman shot at a photo of President Donald Trump and another former U.S. president and witnesses reported he was making statements "critical of American military actions overseas" during the attack, FBI Deputy Director David Bowdich said.
The December shooting raised questions about how well international military students are screened before they attend training at American bases. Some lawmakers, including a top Republican ally of Trump, have called for Saudi Arabia to be suspended from the American military training program.
Trump called for the program to be reviewed. But Sen. Lindsey Graham, R-S.C., said the program needed to be reevaluated after the attack.
National security adviser Robert O'Brien said Sunday in an interview on Fox News that the shooting "showed that there had been errors in the way that we vetted" the students. The actions being taken by the Justice Department and Defense Department to remove the Saudi students are to "protect our service men and women," he said.
The Pentagon has done a broad review of the vetting process for international students, and officials have said they are likely to increase the Defense Department's role in the screening.
Navy Capt. Brook DeWalt, a Pentagon spokesman, said Monday that Defense Secretary Mark Esper has the results of the vetting review and the department will release appropriate information in the near future.
Twelve of the trainees who were removed were assigned to the base in Pensacola and nine others were assigned to Air Force bases in the U.S., including in Mississippi, Texas and Oklahoma, a senior Justice Department official said. The trainees were all removed from the U.S. on a Saudi government aircraft on Monday, the official said.
Of the 21 sent home, 17 had social media containing jihadi or anti-American content. Fifteen had some kind of contact with child pornography. One of the trainees had possessed over 100 images of child pornography and had searched for the material but the U.S. attorney's office determined there wasn't enough evidence to warrant federal prosecution.
In a statement, the Saudi embassy called the shooter a "disturbed and radicalized" individual who acted alone and who does not represent the values of Saudi Arabia or the hundreds of thousands of Saudis who have lived and studied in the U.S. over the decades. It said it had cooperated with the investigation and would continue to do so.
"It is worth noting that the military training that the US provides to Saudi military personnel has enabled Saudi soldiers, pilots and sailors to fight along their American counterparts and against our common foes," the statement said.
Investigators, meanwhile, have been trying to access two of Alshamrami's devices — an iPhone 7 and an iPhone 5 — but have been unable to access them because the phones are locked and encrypted, according to a letter from the FBI's general counsel, Dana Boente. The FBI has received a court authorization to search the phones and the devices have been sent to the bureau's lab in Quantico, Virginia, he said.
The investigation is considered a "high-priority national security matter," Boente said in the letter.
FBI officials have sought help from other federal agencies and other experts, and investigators have been trying to guess the passwords, but those efforts have been unsuccessful, according to the letter.
Apple said in a statement Monday that it rejected any characterization it had not provided substantive assistance in the investigation. It said it has "produced a wide variety of information" as part of the probe, including iCloud backups, account information and other data about transactions.
While Apple and the FBI have been in discussions over the last week, Apple has not yet told the Justice Department whether the company has the capability of accessing the phones, another senior Justice Department official said. The official spoke on condition of anonymity to discuss an ongoing investigation.
Apple said it only learned last week that the gunman had a second iPhone and that the FBI had been unable to access the devices. The company said its engineers had a call with the FBI to "provide additional technical assistance" and it would continue to cooperate with investigators.