More than 20 Saudi military students who have been training in the United States are being sent home today after a counterterrorism investigation found they possessed “derogatory material” — including child pornography and anti-US media.

That evidence came to light as part of the Justice Department’s investigation of the mass shooting at a Naval Air Station in Pensacola, Florida, last month that killed three and wounded eight others.

The shooter, who was killed by a sheriff’s deputy during the attack, was a 21-year-old member of the Saudi Royal Air Force. He, along with nearly 900 of his compatriots, came to the US as part of a program in which the American military provides classroom instruction, language classes, and flight training to members of foreign militaries allied or partnered with the US.

At a Monday press conference, Attorney General William Barr stated that the shooter was “motivated by jihadist ideology” and that the attack “was an act of terrorism,” but that there “was no evidence of any affiliation or involvement with any terrorist activity or group.”

Barr said the shooter acted alone, and there was no evidence that other Saudi trainees at the base participated or had any foreknowledge of the attack.

However, he said that, during the course of the investigation, “We did learn of derogatory material possessed by 21 members of the Saudi military who were training in the United States; 17 had social media containing some jihadi or some anti-American content.”

What’s more, 15 Saudi students — including some of the 17 above — “had some kind of contact with child pornography,” Barr said. “While one of these individuals had a significant number of such images, all the rest had one or two images, in most cases posted in a chat room posted by some other person or received through social media.”

US officials didn’t release any of the evidence for these allegations, so the exact nature of the “anti-American” content is unclear.

The government of Saudi Arabia, which Barr said cooperated fully with the investigation, “determined that this material demonstrated conduct unbecoming an officer in the Royal Saudi Air Force and in the Royal Navy,” Barr said. “[T]he 21 cadets have been disenrolled from their training curriculum in the U.S. military and will be returning to Saudi Arabia later today.”

It’s unclear what will happen to them when they arrive, but Barr said that if the US decides to charge any of the 21 individuals as part of a counterterrorism investigation, the Saudi government has agreed to return them to the US for trial.

AG Barr: "While there is no evidence of assistance or pre-knowledge of the attack by other members of the Saudi military or any other foreign nationals..., we did learn of derogatory material possessed by 21 members of the Saudi military who were training in the United States." pic.twitter.com/hNLHfbt3g8 — CBS Evening News (@CBSEveningNews) January 13, 2020

The Saudi embassy in Washington put out a statement on Monday, saying that joint efforts on counterterrorism is “making the world a safer place.”

The close cooperation between the two nations on intelligence matters & counter terrorism has saved the lives of many in the US, KSA and elsewhere, making the world a safer place.

Over 28,000 Saudis have undergone military training in the US over several decades without incident. — Saudi Embassy (@SaudiEmbassyUSA) January 13, 2020

US-Saudi ties are under fire again

This is potentially a blow to the US-Saudi relationship. Washington has had close ties with Riyadh for decades, but they’ve gotten closer since President Donald Trump took office.

Trump sees Saudi Arabia as a wealthy nation that buys extensive US military equipment, and Saudi Arabia sees the US as an important ally in its regional struggle with Iran.

Those ties have most visibly manifested themselves in America’s ongoing support for the Saudi-led war in Yemen, which began under President Barack Obama but continues under Trump, despite his insistence on extricating Washington from wars in the Middle East.

While the Justice Department’s announcement is unlikely to upend the relationship, it will certainly complicate it. After all, 15 of the 19 hijackers during the September 11, 2001, attacks were from Saudi Arabia, and at least six of the terrorists in those attacks received flight training in the US. In fact, there were initial worries — since proven untrue — that four of the Saudi hijackers had trained at Pensacola.

This most recent incident has distant but disturbing echoes of 9/11 and has raised concerns about how the US vets the roughly 5,000 foreign military students from 152 countries training at US bases right now.

In the immediate aftermath of the Pensacola shooting, leading Florida Republicans, including Trump allies Sen. Rick Scott and Rep. Matt Gaetz, called for a review of how the US admits foreign military students into their state before training them further. This latest news is likely to revive those calls.