Under different circumstances, it would be a public-relations coup for Apple: The company has proved that its consumer software is so secure that even the federal government, with all its money, experts, and supercomputers, can’t crack it. Unable to best the software, the FBI had to come to Apple, hat in hand, defeated.

Except that’s not really a hat in the FBI’s hand—it’s a court order. And the government isn’t humbly asking for assistance; it’s demanding it, and it has a federal judge on its side.

More than two months after a pair of shooters killed 14 people in San Bernardino, California, the FBI has still not been able to break into one of the attackers’ phones, which was recovered at the scene. The device, an iPhone 5c which belonged to Syed Farook, is locked with a passcode. Crucially, Farook’s phone is set to wipe its contents after 10 attempts to log in with the wrong code.

So the FBI wants Apple to help it break in. According to court documents, the government is asking Apple to create a special version of the operating system that’s currently on Farook’s phone, in order to disable the 10-try maximum and allow a computer to connect to the phone and guess every possible passcode.

It may seem like an easy choice for Apple to comply. Law-enforcement officials have repeatedly said the virtually unbreakable encryption that protects Apple’s iPhones helps terrorists. Americans remain very afraid of terrorism—two in three say a terrorist attack is likely or very likely in the next several weeks—so this is a chance for the company to appear tough on terror without severely undermining its pro-privacy stance.

But that’s not what’s happening. Tim Cook, who has recently become an unofficial spokesman for pro-encryption tech companies, dug in his heels in an open letter published on Apple’s website just hours after the court order was released.

Cook called the implications of the FBI request “chilling,” and argued that it sets a precedent for wider government access of consumer data. “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,” Cook wrote.

With this message to his customers, Cook is thrusting the long-simmering debate over law-enforcement access to encrypted data farther into the public sphere than it’s ever been before. The government has repeatedly called for a dialogue over encryption, but such dialogue generally takes the form of officials meeting with tech executives behind closed doors.

Apple’s move imitates a tactic that has served Uber well in the past, as The Wall Street Journal’s Daisuke Wakabayashi observes. When Uber butted heads with city governments from San Francisco to New York, it enlisted its enormous user base to show support for the company. In nearly every case, it prevailed, and secured friendly regulations that allowed it to continue growing.

Apple is hoping its customers will assemble behind its public resistance to the government. It’s gambling that its strong pro-privacy and pro-security stance will win over the public, even if it allows the FBI to paint it as soft on terrorism.

But Donald Trump has already seized on that soft-on-terror angle to bash Apple: “I agree 100 percent with the courts,” Trump said on Fox and Friends. “To think that Apple won't allow us to get into her cellphone—who do they think they are?” And Tom Cotton, a Republican senator from Arkansas, said Apple “chose to protect a dead ISIS terrorist’s p‎rivacy over the security of the American people.”

Being pro-privacy has become an important part of Apple’s image in recent years, and it’s pushed for genuinely consumer-friendly policies. The company sees itself at the vanguard of the pushback against what it considers government overreach, and is protecting a broad set of interests with its push for strong encryption. If this case were to set a legal precedent for the FBI to access its consumers’ data, the company would probably lose some number of privacy-conscious customers. But the blow to computer security would reverberate more widely than just in Apple’s world, and could have broad effects on the U.S. economy, large parts of which depend on encryption.

Already, digital human-rights organizations and technology advocacy groups have signaled support for Apple. Cook’s letter was met with cheers from the Electronic Frontier Foundation and the American Civil Liberties Union, New America, the Center for Democracy and Technology, and others.

Fight for the Future, a grassroots organization known for its successful advocacy campaign against anti-piracy bills in 2012, is trying to mobilize people to show support for Apple’s disobedience. It’s planning demonstrations next week in front of Apple Stores across the country to deliver a message to the government: “Don’t break our phones.”

Whether public opinion will coalesce around Apple’s opposition remains to be seen. For now, lawmakers are staking familiar claims in the fight. The top two members of the Senate Intelligence Committee—Richard Burr, a Republican from North Carolina, and Dianne Feinstein, a California Democrat—have taken the FBI’s side. “Court orders are not optional and Apple should comply,” Burr said in a statement. Meanwhile, longtime privacy hawk Ron Wyden, a Democrat from Oregon, said the FBI’s case risks setting a “dangerous precedent.”

If Cook’s intervention gets a swath of the public curious about the encryption that protects their own data from hackers and criminals, the government could end up looking overeager to find ways of accessing private information. But Apple may have a hard time going at it alone. Edward Snowden noted on Twitter that Apple’s fellow tech giant, Google, hasn’t yet weighed in on “the most important tech case in a decade.” If, instead of leading a rebellion against government surveillance, Apple is seen by the public to be obstructing a federal investigation into an act of terrorism, Cook’s stand could backfire.