It is a battle for public opinion almost as much as it is for the law.
And in Apple Inc., the government faces a formidable corporate foe — an iconic American brand that merely has to stand up for privacy to keep the reputation of its products intact. If the company loses in court, chances are it's still business as usual for the iPhone.
For the government, the stakes are higher. It has chosen the encrypted iPhone of San Bernardino shooter Syed Rizwan Farook to make its long-held case that airtight consumer electronics are undermining national security. A loss in court would likely widen the gap between technology and law enforcement, making its job that much harder at a time when Silicon Valley and Washington have struggled to see eye-to-eye.
"They're in a win-win situation," Angelo Zino, an analyst at S&P Global Market Intelligence, said of Apple after issuing a strong buy recommendation for the company's stock Monday. "The immediate term may look bad for them, but there's absolutely no impact on the fundamentals of the company. They're the darlings of many consumers."
Of course, no one picks a fight with the federal government without facing considerable risk.
Apple is the subject of withering criticism and pressure from Washington, including charges from the Department of Justice that the company is more interested in its marketing strategy than the law. Indeed, the developments of the last week have showered substantial attention on Apple, which has used the opportunity to trumpet itself as a protector of privacy for all.
The FBI sees it all as spin. On Sunday, FBI Director James Comey intensified the war of words for public support by invoking the slaughter of Farook's 14 victims and called on Americans to reconcile "how to both embrace the technology we love and get the safety we need."
That conversation has invariably spilled into the presidential primaries.
Republican candidate Donald Trump has called for a boycott of Apple, underscoring the potential for a populist backlash against the Cupertino, Calif., company.
Already, a Pew Research Center telephone survey released Monday shows more Americans (51%) favor unlocking the device than keeping it encrypted (38%). Although not one-sided by any means, the results did show more people siding with the government, regardless of political leaning, age and even among iPhone owners.
Some analysts said to take surveys with a grain of salt.
"People in online polls have knee-jerk reactions when there's no clear impact on them," said Peter Misek, a board advisor at DN Capital and a former financial analyst who followed Apple. "I suspect it would be a very different response if consumers were [asked]: 'Do you consent to having the entirety of your phone searched in investigations?'"
Others say U.S. public opinion matters little for Apple. What counts is what consumers — particularly potential new customers — in the company's growth markets such as China, Russia and Brazil think.
"Everybody recognizes that the U.S. market is not the largest part of Apple's market," said Jonas Kron, senior vice president at Trillium Asset Management, which manages $2 billion in assets. "Apple seems to have a clear vision that being a strong protector of privacy is in their best interests, and we'll have to see how big global audiences respond to this."
The FBI battle could become a major conversation at Apple's annual meeting with shareholders Friday. The iPhone accounts for about two-thirds of Apple's revenue and a significant share of its profit. Even the faintest signal that iPhone sales or consumer sentiment about the device is shifting can have huge effects on shares of the world's most valuable public company by market capitalization.
Apple Chief Executive Tim Cook wrote to employees Monday that he's received messages from thousands of people across America in the last week, the majority of them supporting the company's position. He cited two emails in particular, one from a 13-year-old software developer whom he said thanked Cook for standing up for "all future generations."
A group advocating for freedom of the Internet called Fight for the Future has organized rallies outside Apple stores worldwide Tuesday in support of the iPhone maker.
Cook has framed the fight as one for the future of digital privacy. Creating a back door to unlock Farook's phone would open a Pandora's box, the company said.
Cook's letter came a day after the FBI's Comey said the agency's request was isolated.
"I hope folks will take a deep breath and stop saying the world is ending, but instead use that breath to talk to each other," Comey said in a statement.
"We simply want the chance, with a search warrant, to try to guess the terrorist's passcode without the phone essentially self-destructing and without it taking a decade to guess correctly. That's it," Comey said. "We don't want to break anyone's encryption or set a master key loose on the land."
For an extremely private company, Apple's loud and very public stance is not surprising given what's transpired since NSA contractor Edward Snowden revealed widespread cooperation between the government and technology and telecommunications providers to analyze consumers' conversations.
AT&T, Verizon and other companies faced a public lashing for not doing more to fight government orders. Shareholders pushed back at companies named in the Snowden files, worried about the risk that close ties to the U.S. government could have to sales across the world.
Apple could end up avoiding the same scrutiny because of its transparency now.
"Some consumers will look at this and say, 'Apple is fighting for my data' and that will reflect well on Apple," said Daniel Castro, vice president of the Information Technology and Innovation Foundation. "This all helps Apple's reputation."
A survey this year by management consulting firm Cg42 found consumers held Apple and Google in higher regard over privacy than Verizon and T-Mobile. Moreover, the firm also found that the more people learned about what kind of digital personal information was available to industry and government, the more concerned they became about privacy.
"It's critical for Apple to take the stance it has taken because the awareness of what is at risk every day is becoming higher to the average consumer," said Stephen Beck, managing partner at Cg42.
In the end, consumers could simply decide they can't live without the iPhone, regardless of what happens to the FBI's case. There's a reason why Apple has sold nearly a billion units since it was introduced in 2007.
"Even if people side with the FBI, they are still going to buy their iPhone," said Gene Munster, a stock analyst at Piper Jaffray. "Their philosophy on this doesn't outweigh the utility that the iPhone gives them. Yes people may say they support the FBI, but they won't change their buying behavior."
Munster didn't discount the possibility that Apple could lose in the court of public opinion.
"But more likely," he said, "it just blows over and it's a non-event. For the average person, it's just not that big of a deal."
MORE ON APPLE VS. FBI