Tim Cook at the D11 Conference. Photo by Asa Mathat | D: All Things Digital"

Apple is in a tight squeeze.

The FBI and a federal district court demanded on Tuesday that the company help break into a iPhone owned by one of the San Bernardino terrorists. According to Apple CEO Tim Cook, doing so would require the company to create a digital version of a “master key” for all iPhones, and that could expose millions of owners worldwide to dangerous intrusions.

In an open letter to customers, Cook said Apple has chosen to stand for privacy and will oppose the order.

The feds have long sought the help of tech companies in making it easier to conduct surveillance of criminals and terrorists. So far, techies have cooperated up to a point. Encryption is one of the areas the two sides sharply disagree. A showdown between Apple and the federal government could prove to be a landmark case.

On Tuesday, Sheri Pym, a federal magistrate for the Central District of California, ordered Apple not to turn off the iPhone’s encryption but to release a software update that would make it easier for the FBI to guess the iPhone’s password. For months, the FBI has failed to unlock the passcode protecting the iPhone owned by one of the two shooters in December’s San Bernardino terrorist attack. Apple says that what Pym wants would effectively turn off encryption.

“The implications of the government’s demands are chilling,” wrote Cook in the letter to customers. “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.”

Right now, it would take more than five years to guess all the possible passwords, and long before that occurred all the data would be automatically erased. Apple built a self-destruct mechanism into the iPhone that automatically deletes the phone’s data in the case too many incorrect passwords are entered. This is designed to protect users from losing important information.

Cook said the fix Pym requested could be used again and again in the United States or overseas. Nobody can guarantee the key wouldn’t be misused, Cook argued.

The CEO wrote in his letter that he “can find no precedent for an American company being forced to expose its customers to a greater risk of attack.”

Cook noted that Apple has “no sympathy for terrorists” and loves the United States. But he says the risks in creating a key are too great. Read his entire note here.

Like what you're reading? Subscribe to GeekWire's free newsletters to catch every headline

Job Listings on GeekWork

Find more jobs on GeekWork. Employers, post a job here.