Updated

The shooting carried out by a Saudi aviation student at Naval Air Station Pensacola in December was an "act of terrorism," Attorney General William Barr said Monday as officials released their findings from their investigation into the attack.

Barr said the gunman, identified as Royal Saudi Air Force 2nd Lt. Mohammed Saeed Alshamrani, was "motivated by jihadist ideology." His comments came as the U.S. was expelling 21 Saudi nationals living in America who, like Alshamrani, trained with the U.S. military at facilities including NAS Pensacola.

Senior Justice Department officials told Fox News the 21-year-old shooter left a "trail of extremism" in the days and weeks leading up to the attack

"During the course of the investigation, we learned that the shooter posted a message on September 11, [2019] stating, ‘the countdown has begun,’" Barr said. "During the Thanksgiving weekend, he then visited the 9/11 Memorial in New York City.

"He also posted other anti-American, anti-Israeli and jihadi messages on social media, including two hours before his attack," Barr added.

The NAS Pensacola shooter was identified as Mohammed Alshamrani, a 21-year-old 2nd lieutenant in the Royal Saudi Air Force who was a student naval flight officer of Naval Aviation Schools Command. (FBI)

The NAS Pensacola shooter was identified as Mohammed Alshamrani, a 21-year-old 2nd lieutenant in the Royal Saudi Air Force who was a student naval flight officer of Naval Aviation Schools Command. (FBI)

AFTER PENSACOLA SHOOTING, PENTAGON SUSPENDS FLIGHT TRAINING FOR HUNDREDS OF SAUDI STUDENTS

Alshamrani ultimately killed three U.S. sailors and severely wounding eight other Americans in the Dec. 6 attack, according to Barr.

Most of the 21 cadets being expelled "had some kind of contact with child pornography" and social media containing "some jihadi or anti-American content," the attorney general said.

"However, there was no evidence of any affiliation or involvement with any terrorist activity or group," he added.

Barr mentioned that the "relevant U.S. attorney’s offices independently reviewed each of the 21 cases involving derogatory information and determined that none of them would – in the normal course – result in federal prosecution."

Senior DOJ officials told Fox News the expelled cadets were not "given a free pass."

Yet, Barr added, "Saudi Arabia determined that this material demonstrated conduct unbecoming an officer in the Royal Saudi Air Force and in the Royal Navy and the 21 cadets and have been disenrolled from their training curriculum in the U.S. military and will be returning to Saudi Arabia later today."

PENSACOLA SHOOTING LEADS NAVY INSTRUCTOR PILOTS TO TELL TOP BRASS: 'ARM US'

A law enforcement source told Fox News earlier Monday that "more than a dozen" Saudi nationals who were part of the training program -- who had ties to extremist groups -- were to be sent back home. Those individuals were not linked to the Pensacola shooting, though, the source added.

NAS Pensacola is home to the Naval Education and Training Security Assistance Field Activity's International Training Center, which Navy officials said was "established in 1988 to meet the aviation-specific training needs of international officers and enlisted students from allied nations."

"Immersing international students in our U.S. Navy training and culture helps build partnership capacity for both the present and for the years ahead," Cmdr. Bill Gibson, the center’s officer in charge, said in 2017. "These relationships are truly a win-win for everyone involved."

Most of the hundreds of foreign aviation students who have participated in the program were from Saudi Arabia, the Navy officials added. The Naval training program has had about 1,500 pilots in total.

Saudis have received training at the Pensacola site since the 1970s, with as many as 20 students from the Middle Eastern country in any given class, sources told Fox News. Many of the students often were from the Royal Family, putting pressure on officials to pass pilots through the training program in an attempt to preserve diplomacy with the U.S. ally.

Barr hailed the program Monday, describing the Royal Saudi Air Force as an "important military partner" which "has long had a training relationship with the United States."

The shooting at NAS Pensacola also prompted a group of U.S. Navy instructor pilots to ask top military brass for permission to arm themselves.

FBI ASKS APPLE TO HELP UNLOCK PENSACOLA SHOOTER'S PHONES

One of the shooting victims was the captain of the U.S. Naval Academy rifle team, an "excellent marksman," according to his brother.

"It’s so stupid that on a military base, the shooter was allowed to roam free for so long," one instructor pilot told Fox News in December.

Two pilots said the Saudi shooter had 10 minutes to carry out his deadly assault on defenseless Navy sailors at the "API" -- aviation pre-flight indoctrination -- building.

Senior law enforcement officials told Fox News the attack lasted 15 minutes and Al Shmarani used a Glock nine-millimeter that had five extended magazines. Officails added that the gun was purchased legally in Florida.

A deputy from the Escambia County Sheriff's Office shot and killed Alshamrani.

Meanwhile, the FBI sent a letter to Apple's general counsel, asking for help in accessing data from a pair of iPhones owned by the gunman, as the FBI has been unsuccessful in unlocking the phones.

Barr said Monday, "so far, Apple has not given us any substantive assistance," and he argued the tech giant needed to cooperate further with law enforcement.

"This situation perfectly illustrates why it is critical that the public be able to get access to digital evidence once it has obtained a court order based on probable cause," Barr said. "We call on Apple and other technology companies to help us find a solution so that we can better protect the lives of American people and prevent future attacks."

Apple previously has resisted efforts by government officials to access phone customers’ data, citing a company committed to its customers’ privacy. But, Apple told Fox News it was cooperating in the Pensacola investigation.

"We reject the characterization that Apple has not provided substantive assistance in the Pensacola investigation," the company said in a statement. "Our responses to their many requests since the attack have been timely, thorough and are ongoing."

Apple says the FBI "only notified us on January 6th that they needed additional assistance — a month after the attack occurred.

"Only then did we learn about the existence of a second iPhone associated with the investigation and the FBI's inability to access either iPhone," the statement added.

"We are continuing to work with the FBI, and our engineering teams recently had a call to provide additional technical assistance," it continued. "Apple has great respect for the Bureau’s work, and we will work tirelessly to help them investigate this tragic attack on our nation. "

Fox News has confirmed that Apple already turned over electronic material from Alshamrani’s iCloud account to investigators despite its resistance to unlocking his phones.

One law enforcement official told Fox News the FBI was continuing efforts to unlock the phones but, "it’s unclear when we can get in. It could be tomorrow, it could be 10 years from now."

Another senior DOJ official said the department was doubtful that even Apple could access information on its own devices.

CLICK HERE TO GET THE FOX NEWS APP

In the past, Apple has complied with court orders to unlock phones hundreds of times, the senior DOJ official said, but following the San Bernadino, Calif., massacre in 2015, the company changed protections on its phones, making it much tougher to get in, and has since been unhelpful to law enforcement officials in unlocking any of its devices.

"They haven’t told us whether they have the ability to get into those phones themselves," the official told Fox News.

Fox News' Jake Gibson, David Spunt, Vandana Rambaran, Lucas Tomlinson, Gillian Turner and Fox Business Network's Susan Li contributed to this report.