On Tuesday, Apple will face one of the biggest corporate challenges in its history, when it tells a US House of Representatives committee why it has refused to help law enforcement officers break into the iPhone of Syed Farook – one of the gunmen in the San Bernardino shooting in December that left 14 dead and 22 wounded. The technology giant will be represented by its top lawyer, Bruce Sewell; making the case against it will be FBI boss James Comey.

Apple, the world’s most valuable private company, has come under fire from many in politics and law enforcement after refusing to comply with the 16 February court order.

Described by Apple chief executive Tim Cook as “chilling”, the order would require the company to disable some of the phone’s security measures so the government can find Farook’s passcode. Normally an iPhone’s operating system slows it down every time a wrong passcode is used, so that it is effectively impossible to break in by systematically trying all combinations.

When federal judge Sheri Pym issued the order, Cook claimed privacy was a fundamental right the company had sworn to protect, and Apple quickly mobilised support from the wider technology industry. Technology titans and presidential hopefuls soon took sides.

Apple’s detractors and the FBI say the company is on dubious moral ground. “They made a decision, obviously consciously, to engineer out of the phones the ability to open them,” said Manhattan district attorney Cyrus Vance. “Apple is a great company, a phenomenal company, but no company is above the law.”

Hasn’t Apple unlocked iPhones for law enforcement before?

The company has in the past complied with some 70 requests under the All Writs Act, the law by which the Justice Department is trying to compel it to open Farook’s iPhone 5c. Apple’s lawyers say the company complied with those requests because it could, technically, extract data from locked phones. Since 2014, when it beefed up security on newer devices, it can no longer do this.

Apple’s position is that its products have always offered a high degree of privacy – its co-founder, Steve Jobs, was an intensely private man. That position is likely to please its shareholders, says Angelo Zino at analyst S&P Capital IQ. “Privacy is an extremely important topic for Tim Cook and Apple, and it’s where they try to create a competitive advantage,” he said. Apple sees security as a key differentiator from arch-rival Google, whose Android software is used by third-party manufacturers.

The US Department of Justice says that in an age when people are afraid of the government, Apple is cynically cashing in – its stance just part of its marketing strategy.

Why did Apple make iPhones so secure?

When Apple announced in 2014 that it would no longer be able to break into its phones even under a court order, law enforcement agencies reacted with rage. “The average paedophile at this point is probably thinking, I’ve got to get an Apple phone,” said John J Escalante, then chief of detectives for the Chicago police department. Law enforcement says that evidence on iPhones is often involved in cases with vulnerable victims including drug addicts, trafficked people and abused children.

But former FBI agent Michael German, now at judicial thinktank the Brennan Center, says that is not what is really at issue: “After 9/11, you had this concept of total information awareness. The intelligence community was very enamoured of the idea that all information was available. Much like the NSA, they wanted to see it all, collect it all, and analyse it all.”

The FBI is, he believes, seeking to preserve what it thinks is a golden age of evidence collection, epitomised by the ubiquity of smartphones, apps and social networks, and combined with lack of public awareness about the sale of personal data and a lack of regulatory oversight of surveillance services.

Private companies now record not only what people say, but where they go, what they buy and whom they befriend, and law enforcement agencies find it hard to accept anything less. “When you listen to the tone of the argument,” German added, “it’s as if they think that if data exists, they have a right to it.”

Right on cue, the Justice Department said this month that it was seeking $38m in its 2017 budget to help the FBI develop a workaround to data encryption.

But German, who worked under cover for the FBI and twice infiltrated domestic extremist groups, believes the data collection programmes are a waste of time and money, existing to collect information rather than to act on it. “This fascination with data is driving resources away from where they need to go.”

But where would be the harm in helping in this case?

Apple has to convince the judiciary committee that complying with the order would set a precedent allowing the government to compel others to do the same. Speaking to a Congressional panel last week, Comey acknowledged that the case would “guide how other courts handle similar requests”. At a different hearing on the same day, Microsoft’s top lawyer, Brad Smith, said the company would support Apple, partly out of concern over a precedent being set.

In a related iPhone unlocking case last year, Marc Zwillinger, a key member of Apple’s legal team, offered a flavour of Apple’s legal argument: “A hypothetical consumer could think, ‘If Apple is not in the business of accessing my data, and if Apple has built a system to prevent itself from accessing data, why is it continuing to comply with orders that don’t have a clear lawful basis?’”

Isn’t the FBI asking for a compromise that doesn’t actually break encryption?

The issue at the heart of the dispute has haunted American jurisprudence since Edward Snowden’s disclosure of America’s vast digital domestic spying network. But the FBI’s order is specific enough that it attacks the phone’s security at its weakest point: the user’s necessarily simple passcode.

The break-in method would give Apple a fig leaf, said Darren Hayes, a forensic technologist at New York’s Pace University: “There’s a lot of discussion about weaker encryption and privacy and creating backdoors and that really isn’t the case.” Law enforcement shouldn’t be tarred with the same brush as surveillance, he had said.

Dan Kaminsky, the security expert who made his name with the discovery that one of the most basic parts of the internet, the domain name system, was vulnerable to fraud – disagrees: “Feds want final authority on engineering decisions, and their interests don’t even align with fighting the vast bulk of real-world crime.”

He says the FBI has a vested interest in presenting Apple as stopping police from prosecuting hundreds of hideous crimes, but really Apple is helping law enforcement. Phone theft can expose a wide variety of personal information to identity thieves or other criminals. “If my iPhone is stolen, my emails stay unread, my photos stay unviewed, and I don’t need to notify anyone that the secrets they entrusted me with are going to show up on the internet tomorrow.”

What happens next?

Senators Michael McCaul (Republican) and Mark Warner (Democratic) want a new commission to find a solution mutually acceptable to industry and law enforcement. The stakes are high: the US government wants to see technological solutions implemented broadly. “We have to work together toward a collaborative technology solution that’s going to have to include international operating standards,” said Warner.

That may just delay an inevitable confrontation. The Justice Department and Apple have been at loggerheads over iPhone security for two years, and despite hearings, panels and whole conferences, neither side has budged.

FBI director James Comey has been leading the charge against Apple. Photograph: Andrew Harnik/AP

FOR AND AGAINST

In one of the most polarised US election seasons in recent memory, the “law-and-order” wing of the Republican party has leapt to the defence of the FBI, with presidential hopeful Donald Trump promising to boycott Apple.

The debate has made for strange bedfellows. California Democratic congressman Mike Honda has come down firmly on the side of the tech company, saying that the Department of Justice is seeking to increase its authority “with the tyrannical impulses that were the very reason our country was created”. California Democratic senator Dianne Feinstein, on the other hand, has called on Apple to cooperate following the “terrorist attack in my state” and threatened legislation.

Lining up on Apple’s side have been several tech big names. “I don’t think building back doors is the way to go, so we’re pretty sympathetic to Tim and Apple,” Facebook founder Mark Zuckerberg said. Google boss Sundar Pichai called the judge’s order a “troubling precedent”.

Microsoft founder and world’s richest man Bill Gates seemed to think there ought to be a compromise available: “It is no different than [asking] ‘should anybody ever have been able to tell the phone company to get information? Should anybody be able to get at bank records?’” he told the Financial Times. Microsoft’s general counsel, Brad Smith, however, was rather less ambivalent last week: “We at Microsoft support Apple and will be filing an amicus brief to support Apple’s position in the court case next week,” he said.

Others say they can see both sides – notably Democratic contenders Hillary Clinton and Bernie Sanders. Asked which side of the debate he was on during the Democratic town hall meeting on 18 February, Sanders said: “Both.” Though he was “fearful of Big Brother”, he admitted: “I also worry about the possibility of another terrorist attack against our country.” Clinton agreed. “This is a very hard dilemma,” she said.