Apple has opposed a court ruling that ordered it to help the FBI unlock an iPhone recovered from one of the shooters who carried out the attack in San Bernardino, California in which 14 people died last December.
The move heightens a dispute between tech companies and law enforcement over the limits of encryption.
Apple CEO Tim Cook said the court's demand threatened the security of Apple's customers and had "implications far beyond the legal case at hand."
Yesterday Judge Sheri Pym of US District Court in Los Angeles said that Apple must provide "reasonable technical assistance" to investigators seeking to unlock the data on an iPhone 5C that had been owned by Syed Rizwan Farook.
That assistance includes disabling the phone's auto-erase function, which activates after ten consecutive unsuccessful passcode attempts, and helping investigators to submit passcode guesses electronically.
Federal prosecutors requested the court order to compel Apple to assist the investigation into the 2 December shooting by Farook and his wife, Tashfeen Malik, killing 14 people and injuring 22 others.
The two were killed in a shootout with police.
The FBI has been investigating the couple's potential communications with so-called Islamic State and other militant groups.
"Apple has the exclusive technical means which would assist the government in completing its search, but has declined to provide that assistance voluntarily," prosecutors said.
US government officials have warned that the expanded use of strong encryption is hindering national security and criminal investigations.
Technology experts and privacy advocates counter that forcing US companies to weaken their encryption would make private data vulnerable to hackers, undermine the security of the Internet and give a competitive advantage to companies in other countries.
US government wants us to hack our own customers - Apple
In a letter to customers posted on Apple's website, Mr Cook said the FBI wanted the company "to build a backdoor to the iPhone" by making a new version of the iPhone operating system that would circumvent several security features.
"The government is asking Apple to hack our own users and undermine decades of security advancements that protect our customers - including tens of millions of American citizens -from sophisticated hackers and cybercriminals," Mr Cook said.
He said Apple was "challenging the FBI's demands" and that it would be "in the best interest of everyone to step back and consider the implications."
In a similar case last year, Apple told a federal judge in New York that it was "impossible" for the company to unlock its devices that run an operating system of iOS 8 or higher.
According to prosecutors, the phone belonging to Farook ran on iOS 9.
Prosecutors said Apple could still help investigators by disabling "non-encrypted barriers that Apple has coded into its operating system."
Apple and Google both adopted strong default encryption in late 2014, amid growing digital privacy concerns spurred in part by the leaks from former National Security Agency contractor Edward Snowden.
Forensics expert Jonathan Zdziarski said yesterday that Apple might have to write custom code to comply with the order, presenting a novel question to the court about whether the US government could order a private company to hack its own device.
Mr Zdziarski said that, because the San Bernardino shooting was being investigated as a terrorism case, investigators would be able to work with the NSA and the CIA on cracking the phone.
Those US intelligence agencies could likely break the iPhone's encryption without Apple's involvement, he said.