"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," Cook said in a statement on Apple's website.
Cook is responding to an order by a federal magistrate on Tuesday, compelling it to provide technical assistance to the FBI for its investigation into one of the San Bernardino shooters.
Data on the iPhone is encrypted unless the password is known, which the FBI wants Apple's help in bypassing.
The court directed Apple to provide the FBI with a "signed iPhone software file", essentially a custom version of iOS, which only works on the target device, which is an iPhone 5C.
The software would help the FBI guess the password to the device without being locked out or the device wiping itself after numerous failed attempts.
If it were an iPhone 6, Apple would be unable to comply with the FBI's request because of the 'secure enclave' that comes with Touch ID devices.
"Since the iPhone 5C lacks a secure enclave, nearly all the passcode protections are implemented in software by the iOS operating system and, therefore, replaceable by a firmware update," Guido said.
As Cook sees it, "The FBI wants us to make a new version of the iPhone operating system, circumventing several important security features, and install it on an iPhone recovered during the investigation."
He continued: "The FBI may use different words to describe this tool, but make no mistake: Building a version of iOS that bypasses security in this way would undeniably create a backdoor. And while the government may argue that its use would be limited to this case, there is no way to guarantee such control."
Cook said Apple has provided the FBI with data in its possession and has complied with valid subpoenas as it has in the San Bernardino case, as well as supplying Apple engineers to advise the FBI. However, creating a backdoor would be "too dangerous".
"In the wrong hands, this software, which does not exist today, would have the potential to unlock any iPhone in someone's physical possession," he said.
Apple and Google have beefed up encryption on iOS and Android smartphones and on their systems in general in recent years, in particular since Edward Snowden's disclosures.
Apple vs. FBI: Top 5 distortions, delusions, and downright lies
Although President Obama in October backed away from legislation requiring tech companies to provide an encryption backdoor, claims that terrorists involved in the San Bernardino incident in November and then Paris had used encryption sparked renewed calls in Europe and the US for laws to undermine it.
Computer security experts fairly unanimouslyoppose weakening encryption and, as Cook has said on a number of occasions, argue any advantage gained by doing so introduces even greater risks for consumers.
Cook said the FBI's attempt to use the All Writs Act of 1789 sets a dangerous precedent that would expand its authority.
Ars Technica highlighted yesterday that Apple had been served with an order under the same act in 2014, compelling it give access to an iPhone 5S. That order was issued in the weeks after Apple released iOS 8.
The order in this case, according to Cook, would undo the changes it made in iOS 8 that Apple has said make it technically infeasible to comply with such orders.
"The government would have us remove security features and add new capabilities to the operating system, allowing a passcode to be input electronically. This would make it easier to unlock an iPhone by brute force, trying thousands or millions of combinations with the speed of a modern computer," Cook said.
"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.
"The government could extend this breach of privacy and demand that Apple build surveillance software to intercept your messages, access your health records or financial data, track your location, or even access your phone's microphone or camera without your knowledge," he continued.
Apple has five days to comply with the order unless it can demonstrate that it is unreasonably burdensome.\