The gunman who killed three U.S. sailors at a military base in Florida last year repeatedly communicated with al-Qaida operatives about planning and tactics in the months leading up to the attack, U.S. officials said Monday, as they lashed out at Apple for failing to help them open the shooter's phones so they could access key evidence.

Law enforcement officials discovered contacts between Mohammed Saeed Alshamrani and operatives of al-Qaida after FBI technicians succeeded in breaking into two cellphones that had previously been locked and that the shooter, a Saudi Air Force officer, had tried to destroy before he was killed by law enforcement.

“We now have a clearer understanding of Alshamrani's associations and activities in the years, months and days leading up to his attack,” Attorney General William Barr said at a news conference in which he sharply chastised Apple for not helping open the phones.

The new details, including that Alshamrani had been radicalized abroad before he arrived in the U.S., raise fresh questions about the vetting of Saudi military members and trainees who spend time at American bases. The announcement also comes amid tension with the U.S. over instability in the oil market during the coronavirus pandemic and as the Trump administration faces criticism that it has not done enough to hold the kingdom, which has been trying to improve its international image, accountable for human rights violations.

The criticism directed at Apple could also escalate divisions between the U.S. government and the technology company, which rejected the characterization that it has been unhelpful. The company said Monday that it does not store customers' passcodes, does not have the capacity to unlock passcode-protected devices and that weakening encryption could create vulnerabilities that damage national secuity and data privacy.

Alshamrani was killed by a sheriff’s deputy during the Dec. 6 rampage at a classroom building at Pensacola Naval Air Station. He had been undergoing flight training at Pensacola as part of instruction offered at American military bases to foreign nationals. Besides the three sailors who died, eight other people were injured.

Once unlocked, U.S. officials said, the phones revealed contact between Alshamrani and “dangerous" operatives from al-Qaida in the Arabian Pensinsula, or AQAP, including the night before the attack. They also revealed that he had been radicalized since at least 2015, before he arrived in the U.S., and had meticulously planned the attack.

Alshamrani created minicam videos as he cased a military school building and saved a final will on his phone that purported to explain himself — the same document AQAP released two months after the shooting when it claimed responsibility for it, said FBI Director Chris Wray, who called the attack “the brutal culmination of years of planning and preparation.”

“He wasn’t just coordinating with them about planning and tactics," Wray said. “He was helping the organization making the most it could out of his murders.”

Asked whether al-Qaida had directed or inspired the attacks, Wray said it was “certainly more than just inspired."

The phones have already yielded valuable intelligence, officials said, citing a recent counterterrorism operation in Yemen targeting an AQAP associate Alshamrani was in touch with.

The Justice Department had 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.

But Wray said Apple provided “effectively no help” in unlocking the phones, delaying by months the FBI's ability to access the devices and hampering the investigation since agents did not have a full picture of what to look for or ask about. He did not say what method was used to open the phones, but said it would not be a broad fix to the problem.

Barr used Monday’s press conference to forcefully call on Apple to do more to cooperate with law enforcement.

“In cases like this, where the user is a terrorist, or in other cases, where the user is a violent criminal, human trafficker or child predator, Apple’s decision has dangerous consequences for public safety and national security and is, in my judgment, unacceptable,” Barr said.

In a statement Monday, Apple said it had provided the FBI with “every piece of information avaialble to us, including iCloud backups, account information and transactional data for multiple accounts." It rejected the idea of weakening encryption for law enforcement’s benefit.

“It is because we take our responsibility to national security so seriously that we do not believe in the creation of a backdoor — one which will make every device vulnerable to bad actors who threaten our national security and the data security of our customers," the statement said. "There is no such thing as a backdoor just for the good guys, and the American people do not have to choose between weakening encryption and effective investigations.

Law enforcement officials had previously 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.

Separately, AQAP, al-Qaida’s branch in Yemen, released a video in February claiming the attack. AQAP has long been considered the global network’s most dangerous branch and has attempted to carry out attacks on the U.S. mainland.

U.S. officials had announced in January that they were sending home 21 Saudi military students after an investigation revealed that they had had jihadist or anti-American sentiments on social media pages or had “contact with child pornography.”

Barr said then that Saudi Arabia had 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.

Operational training for Saudis at multiple U.S bases was suspended soon after the shooting, but the Pentagon announced in February that it had given the Navy and other military services conditional approval to resume.

Barr said Monday that the Saudis have been cooperative and have worked with the Pentagon to buttress vetting.

Copyright 2020 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.