Updated

After being denied help from AppleFBI investigators have been able to access the contents of the phones that belonged to the Saudi aviation student who shot and killed three American sailors in December 2019 at Naval Air Station Pensacola, Attorney General Bill Barr said Monday.

Barr said the FBI now has confirmed the shooter had been in contact with Al Qaeda before carrying out the attack.

The breakthrough surrounding the devices once owned by Mohammed Alshamrani, a 21-year-old 2nd Lieutenant in the Royal Saudi Air Force, came as a result of the "relentless efforts and ingenuity of FBI technicians," Barr said.

"The phones contained information previously unknown to us that definitively establishes Alshamrani's significant ties to Al Qaeda in the Arabian Peninsula (AQAP) — not only before the attack but before he even arrived in the United States," he said. "We now have a clearer understanding of Alshamrani’s associations and activities in the years, months, and days leading up to his attack."

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)

Following the Dec. 6 shooting, the FBI asked Apple for help in accessing data from a pair of iPhones owned by the gunman, as investigators had been unsuccessful in unlocking the devices.

NAS PENSACOLA SHOOTING WAS AN 'ACT OF TERRORISM', BARR SAYS

"It was clear at the time that the phones were likely to contain very important information," Barr said Monday. "Indeed, Alshamrani attempted to destroy both of the phones, even going so far as to disengage from the gunfight long enough to fire a bullet into one of the phones."

He added, "Unfortunately, Apple would not help us unlock the phones."

The information eventually recovered from the phones indicated that Alshamrani's "preparations for terror began years ago," according to a statement from the Justice Department.

"He had been radicalized by 2015, and having connected and associated with AQAP operatives, joined the Royal Saudi Air Force in order to carry out a 'special operation,'" the Justice Department said. "In the months before the Dec. 6, 2019 attack, while in the United States, Alshamrani had specific conversations with overseas AQAP associates about plans and tactics. In fact, he was communicating with AQAP right up until the attack, and conferred with his associates until the night before he undertook the murders."

NAS PENSACOLA SHOOTER 'JUST SHOT THROUGH THE DOOR' DURING RAMPAGE, SURVIVOR SAYS

FBI Director Christopher Wray said the "evidence we have been able to develop from the killer’s devices shows that the Pensacola attack was actually the brutal culmination of years of planning and preparation by a longtime AQAP associate."

"He was meticulous in his planning. He made pocket cam videos as he cased his classroom building," Wray added. "He wrote a final will purporting to explain himself and saved it in his phone — the exact same will that AQAP released two months later when they initially claimed responsibility."

Barr said the U.S. also has used information from the phone to launch a recent counterterrorism operation against one of Alshamrani's overseas associates based in Yemen.

"We will not hesitate to act against those who harm Americans," Barr added.

NAS PENSACOLA SHOOTER 'INFURIATED' AFTER INSTRUCTOR NICKNAMED HIM 'PORN STASH', REPORT SAYS

Apple responded in a statement Monday afternoon: "As a proud American company, we consider supporting law enforcement’s important work our responsibility. The false claims made about our company are an excuse to weaken encryption and other security measures that protect millions of users and our national security."

The statement also read: "We sell the same iPhone everywhere, we don't store customers' passcodes and we don't have the capacity to unlock passcode-protected devices. In data centers, we deploy strong hardware and software security protections to keep information safe and to ensure there are no backdoors into our systems. All of these practices apply equally to our operations in every country in the world."

The FBI previously battled the tech giant for access to data stored on an iPhone following the 2015 mass shooting in San Bernardino, Calif. Like in the Pensacola shooting case, Apple did not help investigators, but the FBI eventually succeeded in accessing the device's contents.

Acting Department of Homeland Security [DHS] Secretary Chad Wolf responded Monday, "The FBI findings from the tragic Pensacola navy base shooting last December illustrate that the enduring threat from terrorist organizations, such as Al Qaeda, continues. This incident is a stark reminder that terrorist organizations are just as determined to attack us today as on September 11, 2001. DHS continues to support the investigation and, in the wake of the attack, DHS supported the Departments of State and Department of Defense in reviewing screening and vetting procedures for foreign military students."

Barr in January called the attack an "act of terrorism," noting that Alshamrani was "motivated by jihadist ideology."

"During the course of the investigation, we learned that the shooter posted a message on September 11, [2019] stating, 'the countdown has begun,'" Barr also said that month. "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.

Senior law enforcement officials told Fox News the attack lasted 15 minutes and Alshamrani used a Glock 9mm that had five extended magazines. The gun, they added, was purchased legally in Florida.

CLICK HERE TO GET THE FOX NEWS APP

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

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."

Fox News' Ashley Cozzolino, David Spunt and Fox Business' Susan Li and Hillary Vaughn contributed to this report.