SAN FRANCISCO (AP) -- The tech industry is starting to line up with Apple in its fight against the federal government over the encryption it uses to keep iPhones secure.
Earlier this week, a U.S. magistrate ordered Apple to help investigators break into an iPhone used by one of the San Bernardino mass shooters. Apple has until next Tuesday to challenge that ruling, setting the stage for a legal clash that could determine whether tech companies or government authorities get the final say on just how secure devices like smartphones can be.
CEO Tim Cook decried the order on Tuesday, saying it would degrade iPhone security and make users more vulnerable to spies and cyber thieves. Increasingly, other prominent tech companies agree.
"We stand with @tim_cook and Apple (and thank him for his leadership)!" Twitter chief executive Jack Dorsey wrote in a tweet Thursday afternoon.
In a statement late Thursday, Facebook said it condemns terrorism and also appreciates the essential work of law enforcement in keeping people safe. But it said it will "fight aggressively" against requirements for companies to weaken the security of their systems.
"These demands would create a chilling precedent and obstruct companies' efforts to secure their products," the statement said.
Google CEO Sundar Pichai had earlier voiced support for Apple in a series of tweets. "Forcing companies to enable hacking could compromise users' privacy," Pichai wrote on Wednesday, adding that the case "could be a troubling precedent."
Apple's recent iPhones use encryption security that Apple itself can't unlock. The government isn't asking Apple to help break the iPhone's encryption directly, but to disable other security measures that prevent attempts to guess the phone's passcode.
Cook argues that once such a tool is available, "the technique could be used over and over again, on any number of devices." Law enforcement insists that safeguards could be employed to limit use of the workaround to the particular phone at hand. On Tuesday, Cook posted a 1,117-word open letter that contended the FBI's request might have implications "far beyond the legal case at hand."
For months, Cook has engaged in a sharp, public debate with government officials over his company's decision to shield the data of iPhone users with strong encryption — essentially locking up people's photos, text messages and other data so securely that even Apple can't get at it. Law-enforcement officials from FBI Director James Comey on down have complained that terrorists and criminals may use that encryption as a shield.
While tech companies have spoken against broad government surveillance in the past, the Obama administration has recently sought to enlist the tech industry's help in fighting terrorism. Several companies have recently heeded the administration's request for voluntary efforts aimed at countering terrorist postings on social media.
Civil liberties groups warned the fallout from the San Bernardino dispute could extend beyond Apple.
"This is asking a company to build a digital defect, a design flaw, into their products," said Nuala O'Connor of the Center for Democracy and Technology, a Washington-based group that has criticized government surveillance. In a statement, the center warned that other companies could face similar orders in the future.
Others said a government victory could encourage regimes in China and other countries to make similar requests for access to smartphone data. Apple sells millions of iPhones in China, which has become the company's second-largest market.
"This case is going to affect everyone's privacy and security around the world," said Lee Tien, a staff attorney for the Electronic Frontier Foundation, a digital rights group in San Francisco.
The case turns on an 18th-century law that the government has invoked to require private assistance with law enforcement efforts. Apple has also challenged a federal search warrant based on the same law in a Brooklyn drug case. Apple has complied with previous orders invoking that law — the All Writs Act of 1789 — although it has argued the circumstances were different.
Cook may have no choice but to mount a legal challenge, given his very public commitment to protecting customer data. Two fellows at the Brookings Institution — one of them a former lawyer for the National Security Agency — criticized that stance Thursday, writing that Apple's "self-presentation as crusading on behalf of the privacy of its customers is largely self-congratulatory nonsense."
Cook has made privacy protection a part of Apple's marketing strategy, drawing a contrast with companies like Google and Facebook that sell advertising based on customers' online behavior.
Apple "can't be seen now as doing something that would make their products less safe," said Wendy Patrick, who lectures about business ethics at San Diego State University. "I think everyone saw this issue coming down the pike and Apple always knew it was going to push back when the moment came."
In doing so, Apple risks alienating consumers who put a higher value on national security than privacy. A recent survey by the Pew Research Center found 82 percent of U.S. adults deemed government surveillance of suspected terrorists to be acceptable. Apple's stance drew fire Wednesday from GOP presidential candidate Donald Trump and commentators on Fox News.
Only 40 percent of the Pew respondents said it's acceptable for the government to monitor U.S. citizens, however. The survey also found nearly three-fourths of U.S. adults consider it "very important" to be in control over who can retrieve personal information about them.