Apple will contest a court order to help FBI investigators access data on the phone belonging to San Bernardino gunman SyedRizwan Farook.
The company had been ordered to help the FBI circumvent security software on Farook's iPhone, which the FBI said contained crucial information.
In a statement, Apple chief executive Tim Cook said: "The United States government has demanded that Apple take an unprecedented step which threatens the security of our customers."
"We oppose this order, which has implications far beyond the legal case at hand."
Since September 2014, data on the latest Apple devices - such as text messages and photographs - have been encrypted by default.
If a device is locked, the user's passcode is required to access the data. Entering an incorrect code 10 times will automatically erase the phone's data, if this option has been enabled.
Apple says even its own staff cannot access the data - a move the company made following the Edward Snowden revelations into government surveillance.
The FBI has asked Apple to do two things.
Firstly, it wants the company to alter Farook's iPhone so that investigators can make unlimited attempts at the passcode without the risk of erasing the data.
Secondly, it wants Apple to help implement a way to rapidly try different passcode combinations, to save tapping in each one manually.
The FBI wants to use what is known as a "brute force" attack, trying out every combination until stumbling across the correct one and unlocking the phone.
Farook is understood to have used a four-digit passcode which means there are 10,000 possible combinations.