A woman takes a photograph with a phone, Aug. 27, 2012, in Janesville, Wisconsin. Jeffrey Phelps/Getty Images

Apple Inc. has once again set itself on a collision course with the U.S. government over encryption and privacy. But this time, it's not just a theoretical discussion. The FBI wants access to an iPhone 5C used by one of the perpetrators of the San Bernardino terror attacks, but Apple says that cooperating would create a "backdoor" that anyone could use, compromising the security of hundreds of millions of iOS devices around the globe.

The battle lines are drawn, with Apple, privacy advocates and security experts on one side and U.S. law enforcement, government officials and Donald Trump on the other. Apple may be on shaky ground because of an earlier decryption situation, but on Tuesday, they came out with guns blazing.

In a very public slap in the face for the FBI and U.S. Department of Justice, Apple CEO Tim Cook called a court order to break into the iPhone belonging to a suspect in the Dec. 2 mass shooting in San Bernardino, California, “chilling” and “a dangerous precedent.” Cook’s letter addressed the company’s millions of customers, aiming to explain to the public why Apple isn't cooperating with part of an ongoing terror investigation.

A White House spokesman slapped back Wednesday, arguing that it is not asking for a backdoor, just access to one device.

Apple has been Silicon Valley’s leading voice in opposing any moves by government agencies – both in the U.S. and abroad – to weaken encryption by providing a backdoor for intelligence officials. It is notable that in the wake of Cook’s letter being published, no other major tech company in Silicon Valley has publicly come out in support of Apple.

The FBI specifically wants to defeat a provision in the code that automatically erases data if an incorrect password is entered too many times. “The government would have us remove security features and add new capabilities to the operating system, allowing a passcode to be input electronically," Cook wrote. "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.”

Apple CEO Tim Cook visits an Apple store "Hour of Code" event in New York City, Dec. 9, 2015. Andrew Burton/Getty Images

The problem for Apple is that it has decrypted iPhones before.

The company admitted in an October 2015 court filing in an unrelated case in the Eastern District of New York that it previously unlocked passcode-protected iPhones running on iOS 7 and older versions of the Apple operating system. That changed with iOS 8, when Apple began turning on passcode encryption by default, after the Edward Snowden revelations about the NSA made international consumers concerned about how much of their data was being turned over to U.S. intelligence agencies.

In the past, Apple has argued that unlocking phones would create an undue burden, "diverting man-hours and hardware and software from Apple's normal business operations." Now, in the San Bernardino case, Apple is arguing that doing so would create a backdoor that anyone could use, effectively defeating encryption on hundreds of millions of iOS devices and opening them up to prying governments around the globe. Syed Rizwan Farook, the male shooter in the attacks that left 14 dead, was using iOS 9 on his iPhone.

“It’s not a question of whether Apple has the capability — they have the capability -- but a question of whether the government can say, ‘You need to build another operating system for this software,’” said Susan Hennessey, a fellow at the Brookings institute and a former attorney at the National Security Agency. “There’s one operating system that everyone in the world uses and another operating system Apple can create just for the phones the government is seeking access to, but Apple has elected not to do it. The basic notion is: What a company can do to help the government, it must do.”

Privacy advocates argue that there is no precedent for commanding private companies to hack encrypted devices. “This is an unprecedented, unwise and unlawful move by the government. The Constitution does not permit the government to force companies to hack into their customers' devices," said Alex Abdo, staff attorney with the ACLU Speech, Privacy and Technology Project.

“We have become accustomed to mere rhetoric and impractical sound bites from law enforcement and intelligence agencies around weakening the security of the devices we all use and trust,” said Privacy International’s chief technologist Dr. Richard Tynan. “This is now a concrete step to give the U.S. government the capability to hack into our devices and forcefully make U.S. companies complicit in the process.”

At the heart of the latest dispute between Apple and the government is the All Writs Act, a U.S. federal statute that authorizes courts to issue “all writs necessary or appropriate in aid of their respective jurisdictions.” Instead of issuing a search warrant for a home, for example, a court that invokes the All Writs Act also permits investigators to open the door and carry out any other task essential they deem necessary to carry out a search. In this case, the All Writs Act could give the government the power to try millions of number combinations to unlock a passcode. Apple currently caps the number of attempts at 10.

“It’s a gap-filling measure for issues that Congress hasn’t legislated on yet,” Hennessey said.

Cook’s letter Wednesday comes after a Ninth Circuit judge cited the All Writs Act, giving Apple five days to respond.

It’s a battle that could be settled in the appellate court, or ultimately the Supreme Court, experts say. But it’s not as simple as Apple taking a stand against the U.S. government on digital privacy. In fact, it’s also a big marketing opportunity.

Apple's stance on privacy and encryption is a major selling point for iOS products and a differentiator from Android, which is open-source.

“Technology companies need to rebuild their credibility with the international market, so certainly Apple wants to fight this publicly,” said Jim Lewis, director at the Center for Strategic and International Studies. “But I don’t think it matters what the U.S. market thinks — Apple has to reassure global customers they’re not giving U.S. agencies unlimited access to customer information.”

What is less clear is how the public will react to what is admittedly a complicated argument with lots of certainty on both sides. Apple supporters organized by the privacy advocacy group Fight for the Future are planning to hold protests against the government outside Apple stores throughout the U.S. Meanwhile, Republican presidential candidate Donald Trump blasted the company during an appearance on Fox News Wednesday, saying, “To think that Apple won’t allow us to get into her cell phone? Who do they think they are? No, I think we have to open it up.”

The strong stance taken by Apple is likely to be replicated by others, and that could mean many more problems for law enforcement. “I think this is only the beginning,” former FBI special agent Leo Taddeo told IBT. “As the deployment of powerful encryption on cell phones becomes more commonplace, more crimes will go unsolved. This means more criminals will get away and more Americans will be victims.”