Apple has formally opposed an order from a US judge to help law enforcement break into an iPhone owned by one of the San Bernardino shooters. In a rare open letter published on Apple.com, CEO Tim Cook says the FBI is essentially asking the company to create a backdoor for the iPhone's built-in encryption, something it has refused to do for many years. Cook says that complying with the order would have "implications far beyond the legal case at hand," undermining users' privacy and giving the US government "the equivalent of a master key, capable of opening hundreds of millions of locks."

"Doing so would hurt [...] well-meaning and law-abiding citizens."

"The government is asking Apple to hack our own users and undermine decades of security advancements that protect our customers," writes Cook. "We can find no precedent for an American company being forced to expose its customers to a greater risk of attack. For years, cryptologists and national security experts have been warning against weakening encryption. Doing so would hurt only the well-meaning and law-abiding citizens who rely on companies like Apple to protect their data."

Apple says the FBI has asked it to make a new version of the iPhone operating system that would undermine certain security features. Since the introduction of iOS 8, Apple has stopped storing encryption keys that potentially allow third-parties to unlock users' data, essentially tying its own hands so it cannot comply with orders like that in the San Bernardino case. It's been unclear up until now how the company would be expected to bypass this feature, but Cook writes that the FBI has asked it to modify the operating system so that passcodes can be input electronically. This would make it easier for an iPhone to be unlocked using a "brute force" attack — using a powerful computer to input hundreds of thousands of combinations in quick succession.

Apple has warned that other governments will copy American demands for a backdoor

Cook says that although the FBI and the government have taken care to avoid describing this method of access as a backdoor, this is what the order amounts to. "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," writes Cook. Apple has stated many times in the past that the creation of any sort of backdoor would set a dangerous precedent. Such software might fall into the hands of hackers, and lead to similar demands for access from nation states like Russia and China.

In the San Bernardino case, the FBI wants information from an iPhone 5c owned by Syed Farook, who, along with his wife Tashfeen Malik, killed 14 people at a Californian health clinic on December 2nd. Court papers say that accessing the data required technical assistance that Apple "declined to provide voluntarily," leading to the order from the federal judge demanding help.

Help unlocking an iPhone might only be the first concession

In his open letter, Cook notes that the FBI's legal basis for their demand comes from a federal statue from 1789 known as the All Writs Act. Cook says that if the government uses this act to make iPhones easier to unlock, it could just as easily demand that Apple builds "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."

Apple's decision to fight the order is a significant event in the ongoing battle between tech firms and governments over users' data. Other companies including Microsoft and Google have also spoken out publicly about the dangers of weakening encryption, but Apple's objections have often been the most noticeable — not least because of the company's decision to make user privacy a key part of its pitch to customers. Last month, Cook visited the White House and reportedly criticized the administration for failing to publicly defend encryption.

Cook concludes his open letter by stating: "While we believe the FBI’s intentions are good, it would be wrong for the government to force us to build a backdoor into our products. And ultimately, we fear that this demand would undermine the very freedoms and liberty our government is meant to protect."