Apple Chief Executive Tim Cook said the company will oppose a federal judge's order to help the Justice Department unlock a phone used by a suspect in the San Bernardino, Calif., attack.
In a strongly worded letter to customers posted on Apple's website early Wednesday, Mr. Cook called the order an "unprecedented step which threatens the security of our customers" with "implications far beyond the legal case at hand."
The order, reflected in legal filings unsealed Tuesday, marks a watershed moment in the long-running argument between Washington and Silicon Valley over privacy and security.
In the order, U.S. Magistrate Judge Sheri Pym agreed with a Justice Department request that Apple help unlock an iPhone 5C once used by Syed Rizwan Farook. The order calls on Apple to disable certain security measures on the phone, including a feature that permanently disables the phone after 10 unsuccessful tries at the password. Such measures have kept agents from reviewing the contents of the phone, according to the filing. When the phone is locked, the data is encrypted.
Apple said it has cooperated with the Federal Bureau of Investigation during the investigation, complying with valid search warrants and subpoenas. Apple said the government now effectively wants it to create a new version of its iPhone software that bypasses important security measures.
The order, Mr. Cook wrote, asks the company "for something we simply do not have, and something we consider too dangerous to create."
"The government is asking Apple to hack our own users and undermine decades of security advancements which protect our customers--including tens of millions of American citizens--from sophisticated hackers and cybercriminals," said Mr. Cook. "We can find no precedent for an American company being forced to expose its customers to a greater risk of attack."
In the statement, Apple also questioned the U.S. government's use of the All Writs Act of 1789 to "justify an expansion of its authority" through the request.
"The implications of the government's demands are chilling. If the government can use the All Writs Act to make it easier to unlock your iPhone, it would have the power to reach into anyone's device to capture their data," wrote Mr. Cook.
Apple said it isn't opposing the order lightly nor does it question the FBI's intentions, but it feels that the government has overreached.
In her order, Judge Pym gave Apple five days to appeal.
Write to Daisuke Wakabayashi at Daisuke.Wakabayashi@wsj.com