The Justice Department and the FBI said Monday that data from the cellphones of a Saudi air force student who opened fire last year at a U.S. military base in Pensacola, Fla., was traced back to the terrorist group al-Qaeda in the Arabian Peninsula, leading to a counterterrorism operation against one of the gunman’s associates in Yemen.

In addressing the latest developments in the terrorism case, Attorney General William P. Barr and FBI Director Christopher A. Wray both sharply criticized Apple — the maker of the dead gunman’s phones — for not helping them unlock the devices.

“Apple’s decision has dangerous consequences for public safety and the national security,” said Barr, who added that the company’s refusal to change its encryption software meant FBI agents spent four months getting into the gunman’s phones.

“We received effectively no help from Apple,” said Wray, who noted that the time it took FBI agents to crack into the phones on their own “seriously hampered this investigation.” While the FBI did eventually get critical evidence, he added, “we really needed it months ago.”

Officials declined to say how the FBI was able to access the phones, but a person familiar with the investigation said agents used a passcode-guessing machine — a process that still took months.

The officials’ comments marked a significant escalation in the on-and-off battle between the Justice Department and Silicon Valley over the issue of encrypted phones. The debate has been at something of a stalemate since 2016, when the Justice Department abandoned a court case that might have settled the issue. That case also involved a dead terrorist’s phone that the FBI first said it could not access, then later did.

In a statement, Apple said Justice Department and FBI leaders were not telling the truth about the company’s role in the investigation.

“We provided every piece of information available to us, including iCloud backups, account information and transactional data for multiple accounts, and we lent continuous and ongoing technical and investigative support to FBI offices in Jacksonville, Pensacola and New York over the months since,” the company statement said. “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.”

Privacy advocates charged that once again the Justice Department had wrongly claimed that its only way to get into a device was for the manufacturer to make it easier for it to do so.

“The boy who cried wolf has nothing on the agency that cried encryption,” said lawyer Brett Max Kaufman of the American Civil Liberties Union.

Barr took his critique of Apple further, saying the company is “facilitating censorship and oppression” by Russia and China, while at the same time frustrating U.S. law enforcement efforts to pursue terrorists, child molesters and other criminals.

Officials declined to offer any more details about the counterterrorism operation that arose out of the Pensacola case, other than to say it targeted Abdullah al-Maliki, whom they had connected to the Pensacola gunman through the phone data.

“The al-Maliki group has been seriously degraded and I’m very pleased with the results,” the attorney general said.

Authorities have previously said the gunman, Ahmed Mohammed al-Shamrani, a Royal Saudi Air Force member who was training at Naval Air Station Pensacola, was motivated by “jihadist ideology,” including a prominent al-Qaeda figure, and had posted anti-American messages on social media about two hours before his attack.

New evidence taken from his phone indicates that his path toward radicalization began around 2015, predating his arrival in the United States. While law enforcement officials Monday castigated Apple, the new information suggests that the government’s own immigration vetting failed to pick up warning signs about Shamrani before he came to the United States.

The Pentagon had already begun an overhaul of its screening process for such military training programs. Defense Secretary Mark T. Esper said that based on the FBI findings, the Pentagon “will take further prudent measures to safeguard our people.”

FBI officials said that during the attack, Shamrani fired shots at pictures of President Trump and a past U.S. president, and witnesses at the scene said he made statements critical of American military actions overseas.

A senior FBI official said in January that while Shamrani did not seem to be inspired by one specific terrorist group, he harbored anti-American and anti-
Israeli views and felt “violence was necessary.” His social media comments, the FBI said, echoed those of Anwar al-Awlaki, a radical Yemeni American cleric with an al-Qaeda offshoot who was killed in a drone strike in 2011.

Shamrani was part of a contingent of Saudi air force personnel training at U.S. military bases. After the attack, investigators found evidence that 17 fellow students had shared Islamist militant or anti-American material on social media, and others had possessed or shared child pornography. As a result, 21 cadets from Saudi Arabia were disenrolled from the training program and sent home.

Souad Mekhennet contributed to this report.