Apple CEO Tim Cook
Apple CEO Tim Cook delivers his keynote address at the World Wide developers conference in San Francisco, California June 2, 2014. Reutes/Robert Galbraith

Apple CEO Tim Cook has released a letter to all customers, challenging the demands of the US government that it help the FBI unlock the iPhone of one of the San Bernardino shooters.

A US federal magistrate judge, on request by the Justice Department, had ordered Apple to decrypt the iPhone of one of the two attackers who killed 14 people in San Bernardino, California in December last year.

But Apple is now set to oppose the order from the court, with Cook calling for a public debate on the matter, and saying customers around the country need "to understand what is at stake".

“The United States government has demanded that Apple take an unprecedented step which threatens the security of our customers,” wrote Cook in the open letter published on the company’s website.

"They have asked us to build a backdoor to the iPhone.

“We are challenging the FBI’s demands with the deepest respect for American democracy and a love of our country.”

The FBI wanted Apple to create a new version of the iPhone operating system to help decrypt the iPhone used by Syed Rizwan Farook, the San Bernardino gunman who was later killed by the police. This 'backdoor' OS, which currently does not exist, would be installed on to Farook's iPhone, which was recovered during investigations into the San Bernardino shooting. The iPhone in question would then be unlocked by an electronically input passcode.

According to Cook, the implications of the government’s demands are “chilling,” and the demand “too dangerous” for iPhone users.

He argues that although the government suggests the 'backdoor' tool will only be used on one occasion, the technique, if created, could be replicated and applied to not just any iPhone, but to several devices like a “a master key, capable of opening hundreds of millions of locks.”

"In the wrong hands, this software...would have the potential to unlock any iPhone in someone’s physical possession.

"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.

....

"The government is asking Apple to hack our own users and undermine decades of security advancements that protect our customers — including tens of millions of American citizens — from sophisticated hackers and cybercriminals. The same engineers who built strong encryption into the iPhone to protect our users would, ironically, be ordered to weaken those protections and make our users less safe."

For years, Apple - like many other tech companies - has used encryption to protect its customers' personal data, including financial information, notes, photos and private conversations. It believes the US government's demands would now undermine these safety precautions, and pose a threat to the privacy of millions of iPhone owners across the country.

"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."

Realed: Apple Pay to hit China on Feb. 18