WASHINGTON — The gunman in last year’s deadly shooting at a military base in Florida was regularly in touch with Al Qaeda for years, including the night before the attack, the country’s top law enforcement officials said on Monday. They also accused Apple of costing them valuable time by refusing to help unlock the gunman’s phone.
The F.B.I. found that the gunman, Second Lt. Mohammed Saeed Alshamrani, a Saudi Air Force cadet training with the American military in Pensacola, had communicated with leaders of Al Qaeda in the Arabian Peninsula and had joined the Saudi military to carry out a “special operation,” Attorney General William P. Barr said at a news conference.
The F.B.I. recently bypassed the security features on at least one of Mr. Alshamrani’s two iPhones to discover his Qaeda links. Christopher A. Wray, the director of the F.B.I., said the bureau had “effectively no help from Apple,” but he would not say how investigators obtained access to the phone.
The evidence found on Mr. Alshamrani’s phone showed that the Pensacola attack was “the brutal culmination of years of planning and preparation,” Mr. Wray said.
The investigation has served as the latest skirmish in a fight between the Justice Department and Apple pitting personal privacy against public safety. Apple stopped routinely allowing law enforcement officials into phones in 2014 as it beefed up encryption. It has argued that data privacy is a human rights issue and that if it were to develop a way to allow the American government into its phones, hackers or foreign governments like China could exploit the same tool.
But law enforcement officials have said that Apple is creating a haven for criminals. The company’s defiance in the Pensacola shooting allowed any possible co-conspirators to fabricate and compare stories, destroy evidence and disappear, Mr. Wray said.
“It was clear at the time that the phones were likely to contain very important information,” Mr. Barr said, adding that President Trump had also asked Apple for help.
Apple pushed back on Monday, saying that it complied with investigators immediately after the shooting by giving the F.B.I. access to Mr. Alshamrani’s online storage accounts and providing continuing support to investigators.
“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,” Apple said in a statement.
Law enforcement officials would not say that Al Qaeda directed Mr. Alshamrani to carry out the shooting, which killed three sailors. But they emphasized his communications with Qaeda leaders, saying they proved that his relationship with the group went beyond simply being inspired to act based on watching YouTube videos or reading extremist propaganda.
Mr. Alshamrani’s radicalization path began as far back as 2015, and he had associated with Qaeda operatives since, Mr. Wray said. He called the gunman “meticulous” in planning his attack. Mr. Alshamrani took videos of a classroom building and wrote a final will and saved it in his phone, Mr. Wray said.
Three weeks after the shooting, Qassim al-Rimi, the leader of Al Qaeda in the Arabian Peninsula, said that his group directed Mr. Alshamrani to commit the murders in Pensacola. Mr. al-Rimi had a copy of Mr. Alshamrani’s will and messages that seemed to show the gunman had been in contact with the Yemen-based group.
Soon after the recorded message was released, the United States confirmed that it had killed Mr. al-Rimi in a drone attack, a major blow to one of Al Qaeda’s last, vibrant branches.
Mr. Wray said that after the bureau gained access to the phone, it provided valuable information to the intelligence community about Abdullah al-Maliki, a Qaeda operative, who was one of the associates of Mr. Alshamrani. The two apparently had contact while Mr. Alshamrani was in the United States.
A senior U.S. official said Mr. al-Maliki was killed in a C.I.A. drone strike in Yemen in the past week or so. He was in the command structure for Al Qaeda in the Arabian Peninsula, and was an important, emerging communications specialist, pushing out Al Qaeda’s message not just in Yemen but globally, the official said.
Mr. Barr said the counterterrorism operation had degraded the capabilities of Al Qaeda in Yemen.
Mr. Alshamrani paused to fire at his iPhone during a firefight with security officers and he was found with a second, badly damaged phone that he had destroyed, leading investigators to conclude that the devices held important data and to seek court orders authorizing them to search the phones.
In January, when Mr. Barr designated the shooting an act of terrorism, Apple refused a Justice Department request to help open the iPhones, prompting speculation that the government would seek another court order to force the company to comply.
The department said that it sought Apple’s help in opening the phones only after other agencies and third-party technology vendors had failed, and it accused the company of slowing the investigation and allowing leads to go cold.
“Finally getting our hands on the evidence Alshamrani tried to keep from us is great,” Mr. Wray said. “But we really needed it months ago, back in December, when the court issued its warrants.”
The standoff between federal law enforcement officials and Apple last came to a head over the 2015 mass shootings in San Bernardino, Calif., that killed 14 people. Eventually, investigators found a way to unlock an iPhone used by one of the attackers without Apple’s help.
The debate centers on when a technology company should be expected to help the government obtain information from encrypted messaging apps that is accessible only through bypassing the password and other security features. Apple routinely gives law enforcement lawful access to information that its users store in their iCloud accounts.
Investigators have long used software to break into the devices by guessing their passcodes. Security researchers say that the technology to do so is well established but that the process takes time. A six-number passcode takes on average about 11 hours to guess.
Both sides were likely to hold up the Pensacola case as evidence of their arguments. Apple has said law enforcement does not need its help to build cases, and the company could argue that the F.B.I.’s entry into one of Mr. Alshamrani’s phones shows that. Law enforcement has said that Apple’s refusal to help has hamstrung countless investigations, and Mr. Barr emphasized that the F.B.I.’s unlocking of Mr. Alshamrani’s phone was not a “scalable solution.”
Indications have emerged that Apple’s security has grown more vulnerable. Last week, Zerodium, a company that acquires and sells weaknesses in smartphone encryption to American agencies to hack into the devices, announced that it had a surplus of such exploits for Apple’s iOS mobile operating system.
The firm’s claims undermine the Justice Department’s and the F.B.I.’s assertions that Apple’s security is preventing lawful interception of data collection, especially on older-model phones. Mr. Alshamrani had an iPhone 7 and an iPhone 5.
Mr. Barr has maintained one of the department’s “highest priorities” is to find a way to get technology companies to help law enforcement gain lawful access to encrypted technology.
“Privacy and public safety are not mutually exclusive,” he said. “We are confident that technology companies are capable of building secure products that protect user information and, at the same time, allow for law enforcement access when permitted by a judge.”
Mr. Wray and Mr. Barr appeared in lock step during the news conference. For Mr. Barr, it provided a platform to publicly support Mr. Wray, whom Mr. Trump has complained about privately over the F.B.I.’s handling of the Russia investigation.
While the F.B.I. has spent the past few years primarily trying to thwart international terrorism inspired by the Islamic State, Mr. Wray told lawmakers last year that Al Qaeda still wants to conduct “large-scale, spectacular attacks,” but is “likely to focus on building its international affiliates and supporting small-scale, readily achievable attacks.”
American counterterrorism efforts have diminished the capabilities of Al Qaeda in Yemen and the Pakistan-Afghanistan region, but the Pensacola shooting still shows the group’s ideology can inspire attacks. In 2016, authorities warned of a vague Qaeda threat.
Even though the casualty count in Pensacola was relatively low by Qaeda standards, simply “pulling off a successful attack on U.S. soil can provide Al Qaeda and its affiliates with a momentum boost and allow the group bragging rights over the Islamic State, which is important in terms of recruitment, prestige and propaganda,” Colin P. Clarke, a senior fellow at the Soufan Center, a New York-based research organization, said in an email on Monday.
“This illustrates just how dangerous one operative can be,” Mr. Wray said.
Even though Mr. Alshamrani was thought to have operated alone, the government expelled 21 other Saudi students who were training with the American military, some of whom had links to extremist movements. After announcing the expulsions, Mr. Barr said that the Saudi government had cooperated with the investigation.
Saudi Arabia has a complicated relationship with Yemen, where it has been embroiled in a lethal, yearslong military battle to end Iranian influence there. Amid the airstrikes, the Islamic State and Al Qaeda in the Arabian Peninsula have seized territory and carried out their own deadly attacks.
Mr. Alshamrani’s ability to train on the base as part of the U.S. military raises a host of thorny issues, including how the Defense Department screens potential recruits from Saudi Arabia. Mr. Barr said the screening and vetting process in this case was insufficient, and Defense Secretary Mark T. Esper pledged in a statement to keep up additional safeguards that the Pentagon had already installed.
After the shooting, the Defense Department ordered a stop to all international military student training at American installations. In January, Mr. Esper imposed tighter restrictions on the use of firearms and access to government facilities for international military students. He approved the continuous monitoring of international students while they are enrolled in U.S.-based training programs.
Between tighter security measures after the shooting and then the coronavirus pandemic, the base in Pensacola has felt different since the shooting, said Jeff Bergosh, a commissioner in Escambia County, where Pensacola is. He said he was heartened to hear investigators had managed to unlock Mr. Alshamrani’s cellphone.
Mr. Bergosh said he hoped policymakers would continue to evaluate foreign military training programs. “Maybe that’s the one thing that comes of this, the one silver lining,” he said.
Reporting was contributed by Patricia Mazzei from Miami, Nicole Perlroth and Jack Nicas from San Francisco, and Eric Schmitt from Washington.