Apple boss Tim Cook has said it would be "bad for America" if his company obeyed the FBI's demand for help unlocking an encrypted iPhone used by one of the San Bernardino killers.

Chief executive Mr Cook said he was prepared to take the dispute to the US Supreme Court and would try to make his case directly to President Barack Obama.

In his first interview since the controversy erupted last week, Mr Cook told ABC News that it was a difficult decision to resist a court order directing Apple to override security features on an iPhone used by Syed Farook, one of two extremists who killed 14 people in the Southern California city in December.

"Some things are hard and some things are right, and some things are both. This is one of those things," Mr Cook said.

The interview came as both sides in the dispute are courting public support through interviews and published statements, while also mustering legal arguments in the case.

Government officials have said they are asking for only narrow assistance in by-passing some security features on the iPhone, which they believe may contain information related to the mass murders.

But Apple has argued that doing so would make other iPhones more susceptible to hacking by authorities or criminals in the future.

Mr Cook expressed sympathy for the shooting victims' families and said his company provided engineers and technical advice to authorities investigating the case. But he said authorities were now asking the company "to write a piece of software that we view as sort of the equivalent of cancer".

The software could "expose people to incredible vulnerabilities", he added, arguing that smartphones contained private information about users and even their families.

"This would be bad for America," he said. "It would also set a precedent that I believe many people in America would be offended by."

Mr Cook disputed FBI director James Comey's argument that the court order applied to only one phone.

"If a court can ask us to write this piece of software, think about what else they could ask us to write," he said.

"Maybe it's an operating system for surveillance. Maybe it's the ability for law enforcement to turn on the camera. I mean, I don't know where this stops."

Apple is expected to file its legal response to the judge's order by Friday.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.