A long-simmering showdown between Silicon Valley and Washington over national security flared into a major political spat Wednesday, after Apple CEO Tim Cook vowed to resist the federal government’s demand for help breaking into an iPhone used by one of the attackers in last year’s deadly mass shooting in San Bernardino, California.

The dispute between the tech giant and the FBI has put the entire industry on the defensive and prompted new calls, from the 2016 campaign trail to Capitol Hill, for tech companies to cooperate in terrorism investigations. Apple’s harshest critics included Donald Trump, who asked on Fox News, “Who do they think they are?” — while Senate Intelligence Committee member Tom Cotton (R-Ark.) charged that the company had chosen to “protect a dead ISIS terrorist's privacy over the security of the American people.”

Story Continued Below

But civil liberties and privacy groups defended Apple, with the American Civil Liberties Union warning that the government's request “risks setting a dangerous precedent.”

“If the FBI can force Apple to hack into its customers' devices, then so too can every repressive regime in the rest of the world,” ACLU staff attorney Alex Abdo said. “Apple deserves praise for standing up for its right to offer secure devices to all of its customers."

Rep. Justin Amash (R-Mich.), a tea party conservative, also took the company’s side. “Govt's demand that Apple undermine safety & privacy of all its customers is unconscionable & unconstitutional,” he said on Twitter, adding: "Thank you, @tim_cook, for defending our rights."

The White House, for its part, refused to jump into the fray, although press secretary Josh Earnest rejected Apple’s accusation that the FBI was seeking a “backdoor” to encrypted communications on iPhones.

The FBI “is not asking Apple to redesign its product or create a new backdoor to one of its products,” Earnest said. “They’re asking for something that would have an impact on this one device.”

The feud erupted Wednesday after a federal judge ordered Apple to create and install special software on the suspect's iPhone so that investigators could try an unlimited number of passwords to crack the device, which is set up to erase its contents after too many failed attempts. The iPhone, found near the site of the December massacre in California that killed 14 people, had been used by one of the shooters, Syed Farook, who authorities say had expressed support for the Islamic State.

Essentially, the FBI wants Apple to eliminate the phone's digital self-destruct mechanism so that investigators have time to break into the device.

Once that special software is installed, how long it takes investigators to crack the device's security could depend on what kind of password Farook used. It could take investigators' computers about an hour to crack a four-digit numeric password by trying every possible combination, said cryptologist Matt Green, an assistant professor of computer science at Johns Hopkins University. It could take up to 100 hours to break a six-digit password, Green said, but the time could be much longer if Farook had used a complex assortment of letters, numbers and other symbols.

Farook’s county-owned phone was reportedly running the latest version of Apple’s iOS operating system, whose encryption is difficult to break and is protected by electronic "keys" that the company does not retain. On the other hand, Farook's phone was a 5C model, which debuted in 2013 and lacks more modern security protections that make it harder — but not impossible — to write software to tamper with them.

In an open letter to customers, Cook wrote of the consequences if Apple is forced to bypass the phone's safeguards. "In the wrong hands, this software — which does not exist today — would have the potential to unlock any iPhone in someone’s physical possession," he wrote.

The judge’s decision amounted to a major victory for the Justice Department, where top law enforcement officials have long fretted about the difficulty of cracking terrorists' and criminals’ encrypted communications on smartphones and apps. But it drew an unusually harsh response from Cook, who slammed the government's move as an "overreach."

The volley of rhetoric that followed represented a new, more intense phase in the long-running debate over how much help tech companies should offer in the fight against terrorism.

Top administration officials, including FBI Director James Comey, have warned for years that terrorists are “going dark,” relying on private channels to plan and execute attacks. But Apple and other tech firms argue that granting special access to the U.S. government would create security risks that harm average Americans and would encourage foreign governments — such as China — to demand similar concessions.Their fierce opposition comes in the wake of Edward Snowden's damaging leaks about the broad scope of U.S. surveillance, revelations that stung the industry worldwide and left companies scrambling to affirm their commitments to users' privacy.

When officials including Comey and Attorney General Loretta Lynch met with tech executives in Silicon Valley last month to seek the industry’s help in the online fight against the Islamic State, Cook even asked them to take a public stance in favor of strong encryption. But they have issued no such statement.

Apple's rebuke quickly generated shock waves on Wednesday in the presidential campaign, in which every remaining Republican candidate has called for greater surveillance of potential terrorist threats.

“Well I hope they would voluntarily, because ultimately I believe being a good corporate citizen is important,” Florida Sen. Marco Rubio said Wednesday when asked about the Apple case. “Look, I think this is a tough issue, there’s no easy answer for the encryption issue. Because on the one hand this encryption was designed to prevent people from having unauthorized access to private information.”

Other leading candidates — including Democrats Hillary Clinton and Bernie Sanders, and GOP contenders like Ted Cruz and Jeb Bush — did not respond to requests for comment. Previously, Clinton has called for a “Manhattan-like Project” to address the thorny issue of encryption, a suggestion that drew ridicule from civil-liberties leaders.

The Apple case could also galvanize activity on Capitol Hill, where tech companies have long faced the threat of legislation that could undermine their security systems. Senate Intelligence Chairman Richard Burr (R-N.C.) and top panel Democrat Dianne Feinstein (Calif.), for example, have said they intend to write legislation to give law enforcement and intelligence agencies access to encrypted products.And Feinstein specifically offered her defense of the court order Wednesday: "It's not unreasonable for Apple to provide technical assistance when ordered by the court," she said.

Sen. John McCain (R-Ariz.) has proposed the idea of legislation that directs companies to provide access with lawful warrants, while leaving the specifics up to the industry. Rep. Mike McCaul (R-Texas), the chairman of the House Homeland Security Committee, has suggested a new commission to the study the issue. The House Judiciary Committee, meanwhile, is expected to hold a hearing on encryption at the beginning of March, an aide told POLITICO on Wednesday.

While the Obama administration decided last year not to ask Congress for legislation that would require tech companies to offer a backdoor to law enforcement, law enforcement officials have pursued their goals through the legal system.

In seeking Tuesday’s ruling from Magistrate Judge Sheri Pym, the Justice Department said Apple had not cooperated when investigators tried to crack Farook’s iPhone. The FBI said it had a copy of an iCloud backup of Farook’s phone, but it couldn’t access data stored on the phone itself between Oct. 15 and Dec. 2, the date of the attack.

Comey appeared to suggest during an appearance on Capitol Hill last week that the U.S. government had struggled to tap the device. "You know, San Bernardino, a very important investigation to us,” he told the Senate Intelligence Committee. “We still have one of those killer's phones that we have not been able to open. It's been over two months now, we're still working on it.”

In his open letter, Cook said Apple had cooperated with the FBI, but that the magnitude of the case requires the company to fight the request.

“We have great respect for the professionals at the FBI, and we believe their intentions are good. Up to this point, we have done everything that is both within our power and within the law to help them,” the Apple CEO said. “But now the U.S. government has asked us for something we simply do not have, and something we consider too dangerous to create. They have asked us to build a backdoor to the iPhone.

“We can find no precedent for an American company being forced to expose its customers to a greater risk of attack,” he added.

Apple and federal prosecutors have already been grappling for months in an unrelated case in New York, where the company has resisted government demands that it unlock a meth dealer's iPhone. In that case, Magistrate Judge James Orenstein suggested in October that the government was probably overstepping its authority under an 18th-century law known as the All Writs Act, while the company has argued that giving in to the prosecutors' demands "could threaten the trust between Apple and its customers and substantially tarnish the Apple brand."