WASHINGTON — The U.S. government’s ability to review and analyze five years’ worth of telephone records for the married couple blamed in the deadly shootings in California lapsed just four days earlier when the National Security Agency’s controversial mass surveillance program was formally shut down.

Under a court order, those historical calling records at the NSA are now off-limits to agents running the FBI terrorism investigation even with a warrant.

Instead, under the new USA Freedom Act, authorities were able to obtain roughly two years’ worth of calling records directly from the phone companies of the married couple blamed in the attack. The period covered the entire time that the wife, Tashfeen Malik, lived in the United States, although her husband, Syed Farook, had been here much longer. She moved from Pakistan to the U.S. in July 2014 and married Farook the following month. He was born in Chicago in 1987 and raised in southern California.

FBI Director James Comey declined to say Friday whether the NSA program’s shutdown affected the government’s terrorism investigation in California.

“I won’t answer, because we don’t talk about the investigative techniques we use,” Comey said. “I’m not going to characterize it.”

White House spokesman Josh Earnest said the FBI was poring through records for the married couple: “This includes things like their foreign travel, their contacts with other individuals, their use of social media,” he said. “There are some details of that investigation starting to dribble out, sometimes in garbled form.”

Amid questions about whether it was constitutional and under pressure from lawsuits and recommendations by two federal panels, the Obama administration agreed to end the NSA phone program. It had secretly collected the daily calling records – but not contents of conversations – for most Americans, including those never suspected of any crime, since at least 2006. Investigators could see who suspected terrorists might be dialing, who else those people might be calling and so on. The government kept five years’ worth of each person’s phone records, deleting older ones on a rolling basis. NSA contractor Edward Snowden revealed the program’s existence in summer 2013.

Under a shutdown order by the Foreign Intelligence Surveillance Court, the government was prohibited from collecting phone records in wholesale ways starting Nov. 29.

“After November 28, 2015, no access to the BR (business record) metadata (phone records) will be permitted for intelligence analysis purposes,” U.S. District Judge Michael W. Mosman of Portland ruled. “Hence, queries of the BR metadata for the purpose of obtaining foreign intelligence information will no longer be permitted. ”

The California shootings happened four days later. The court revealed the order publicly just hours before the shootings.

Under the new law, passed in June, investigators still can look for links in phone records but they must obtain a targeted warrant to get them directly from phone companies, which generally keep customer records for 18 months to two years, although some keep them longer. The U.S. Privacy and Civil Liberties Oversight Board, which studied the program at Obama’s direction, had recommended that the White House reduce the NSA-held phone records from five years to three years even before the program could be shut down.

The FBI was investigating whether the couple in California plotted the attacks with anyone – or each other – in ways that U.S. or allied intelligence surveillance programs might have detected. The FBI director cited “indications of radicalization by the killers, and of potential inspiration by foreign terrorist organizations,” but he said there was no evidence the killers were part of a larger group or terrorist cell. The FBI said it found discarded, crushed cellphones that belonged to the couple near the site of the shootings, and agents were examining the phones’ contents.

An American Civil Liberties Union lawyer, Alex Abdo, noted the California shootings were another case where the NSA’s inspection of Americans’ phone records failed to stop the plot before it happened.

“This could only be an example of the failure of that program,” Abdo said. “If this were a planned attack and the program did what they claimed it did at the time, they would have detected this attack. It’s not surprising the bulk-collection program didn’t detect it.”

Associated Press writer Eric Tucker contributed to this report.