WASHINGTON — Attorney General William P. Barr declared on Monday that a deadly shooting last month at a naval air station in Pensacola, Fla., was an act of terrorism, and he asked Apple in an unusually high-profile request to provide access to two phones used by the gunman.
Mr. Barr’s appeal was an escalation of a continuing fight between the Justice Department and Apple pitting personal privacy against public safety.
“This situation perfectly illustrates why it is critical that the public be able to get access to digital evidence,” Mr. Barr said. He called on technology companies to find a solution and complained that Apple had provided no “substantive assistance,” a charge that the company strongly denied on Monday night, saying it had been working with the F.B.I. since the day of the shooting.
Detailing the results of the investigation into the Dec. 6 shooting that killed three sailors and wounded eight others, Mr. Barr said the gunman, Second Lt. Mohammed Saeed Alshamrani — a Saudi Air Force cadet training with the American military — had displayed extremist leanings.
Mr. Alshamrani warned on last year’s anniversary of the Sept. 11, 2001, attacks that “the countdown has begun” and posted other anti-American, anti-Israeli and jihadist social media messages, some within hours of attacking the base, Mr. Barr said. “The evidence shows that the shooter was motivated by jihadist ideology,” the attorney general said.
The government has also removed from the country some 21 Saudi students who trained with the American military, Mr. Barr said. He stressed that investigators found no connection to the shooting among the cadets, but said that some had links to extremist movements or possessed child pornography. Mr. Barr said the cases were too weak to prosecute but that Saudi Arabia kicked the trainees out of the program.
The battle between the government and technology companies over advanced encryption and other digital security measures has simmered for years. Apple, which stopped routinely helping the government unlock phones in late 2014 as it adopted a more combative stance and unveiled a more secure operating system, has argued that data privacy is a human rights issue. If Apple developed a way to allow the American government into its phones, its executives argued, hackers or foreign governments like China would exploit the tool.
But frustrated law enforcement officials accuse Apple of providing a haven for criminals. They have long pushed for a legislative solution to the problem of “going dark,” their term for how increasingly secure phones have made it harder to solve crimes, and the Pensacola investigation gives them a prominent chance to make their case.
In a statement Monday night, Apple said the substantive aid it had provided law enforcement agencies included giving investigators access to the gunman’s iCloud account and transaction data for multiple accounts.
The company’s statement did not say whether Apple engineers would help the government get into the phones themselves. It said that “Americans do not have to choose between weakening encryption and solving investigations” because there are now so many ways for the government to obtain data from Apple’s devices — many of which Apple routinely helps the government execute.
It will not back down from its unequivocal support of encryption that is impossible to crack, people close to the company said.
Justice Department officials said that they needed access to Mr. Alshamrani’s phones to see data and messages from encrypted apps like Signal or WhatsApp to determine whether he had discussed his plans with others at the base and whether he was acting alone or with help.
“We don’t want to get into a world where we have to spend months and even years exhausting efforts when lives are in the balance,” Mr. Barr said. “We should be able to get in when we have a warrant that establishes that criminal activity is underway.”
The confrontation echoed the legal standoff over an iPhone used by a gunman who killed 14 people in a terrorist attack in San Bernardino, Calif., in late 2015. Apple defied a court order to assist the F.B.I. in its efforts to search his device, setting off a fight over whether privacy enabled by impossible-to-crack encryption harmed public safety.
The San Bernardino dispute was resolved when the F.B.I. found a private company to bypass the iPhone’s encryption. Tensions between the two sides, however, remained, and Apple worked to ensure that neither the government nor private contractors could open its phones.
Mr. Barr said that Trump administration officials have again begun discussing a legislative fix.
But the F.B.I. has been bruised by Mr. Trump’s unsubstantiated complaints that former officials plotted to undercut his presidency and by a major inspector general’s report last month that revealed serious errors with aspects of the Russia investigation. A broad bipartisan consensus among lawmakers allowing the bureau to broaden its surveillance authorities is most likely elusive, though some lawmakers singled out Apple for its refusal to change its stance.
“Companies shouldn’t be allowed to shield criminals and terrorists from lawful efforts to solve crimes and protect our citizens,” Senator Tom Cotton, Republican of Arkansas, said in a statement. “Apple has a notorious history of siding with terrorists over law enforcement. I hope in this case they’ll change course and actually work with the F.B.I.”
Apple typically complies with court orders to turn over information on its servers. But said that it would turn over only the data it had, implying that it would not work to unlock the phones.
Investigators secured a court order within a day of the shooting, allowing them to search the phones, Mr. Barr said. He turned up the pressure on Apple a week after the F.B.I.’s top lawyer, Dana Boente, asked the company for help searching Mr. Alshamrani’s iPhones.
Officials said that the F.B.I. was still trying to gain access to the phones on its own and approached Apple only after asking other government agencies, foreign governments and third-party technology vendors for help, to no avail.
The devices were older models: an iPhone 7 with a fingerprint reader and an iPhone 5, according to a person familiar with the investigation.
Justice Department officials said that investigators have yet to make a final determination about whether Mr. Alshamrani conspired with others. They said that the Saudi government was offering “unprecedented” cooperation but that “we need to get into those phones.”
Mr. Barr and other law enforcement officials described a 15-minute shootout before security officers shot and killed Mr. Alshamrani. During the firefight, Mr. Alshamrani paused at one point to shoot one of his phones once, Mr. Barr said, adding that his other phone was also damaged but that the F.B.I. was able to repair them well enough to be searched.
Mr. Alshamrani also shot at photographs of President Trump and one of his predecessors, said David Bowdich, the deputy director of the F.B.I. A person familiar with the investigation identified the unnamed president as George W. Bush.
Mr. Alshamrani’s weapon was lawfully purchased in Florida under an exemption that allows nonimmigrant visa holders to buy firearms if they have a valid hunting license or permit, officials said.
Law enforcement officials have continued to discuss Mr. Alshamrani’s phones with Apple, they said.
“We’re not trying to weaken encryption, to be clear,” Mr. Bowdich said at a news conference, noting that the issue has come up with thousands of devices that investigators want to see in other cases.
“We talk about this on a daily basis,” he said. Mr. Bowdich was the bureau’s top agent overseeing the San Bernardino investigation and was part of the effort to push Apple to crack into the phone in that case.
But much has also changed for Apple in the years since Tim Cook, its chief executive, excoriated the Obama administration publicly and privately in 2014 for attacking strong encryption. Obama officials who were upset by Apple’s stance on privacy, along with its decision to shelter billions of dollars in offshore accounts and make its products almost exclusively in China, aired those grievances quietly.
Now Apple is fighting the Trump administration, and Mr. Trump has shown far more willingness to publicly criticize companies and public figures. When he recently claimed falsely that Apple had opened a manufacturing plant in Texas at his behest, the company remained silent rather than correct him.
At the same time, Apple has financially benefited more under Mr. Trump than under President Barack Obama. It reaped a windfall from the Trump administration’s tax cuts, and Mr. Trump said he might shield Apple from the country’s tariff war with China.
He had said last month that finding a way for law enforcement to gain access to encrypted technology was one of the Justice Department’s “highest priorities.”
Mr. Alshamrani, who was killed at the scene of the attack, came to the United States in 2017 and soon started strike-fighter training in Florida. Investigators believe he may have been influenced by extremists as early as 2015.
Mr. Barr rejected reports that other Saudi trainees had known of and recorded video of the shooting. Mr. Alshamrani arrived at the scene by himself, and others in the area began recording the commotion only after he had opened fire, Mr. Barr said. They and other Saudi cadets cooperated with the inquiry, he added.
Jack Nicas contributed reporting from San Francisco.