He said such a move would be “bad for America,” and set a legal precedent that would offend many Americans.
“Some things are hard, and some things are right, and some things are both — this is one of those things,” Mr Cook told ABC News in his first interview since the court order came down last week.
He said the government was asking for “the software equivalent of cancer” and that he planned to talk to President Barack Obama directly about getting the dispute “on a better path”.
Later asked whether Apple would be prepared to fight this case all the way to the US Supreme Court, Cook said: “We would be prepared to take this issue all the way.”
Apple’s chief executive also said there should have been more dialogue with the Obama administration before the US Justice Department’s decision to seek relief from a federal magistrate judge in California.
“We found out about the filing from the press, and I don’t think that’s the way the railroad should be run, and I don’t think that something so important to this country should be handled in this way,” Cook said.
Apple has publicly said it intends to fight the court order and has until today to respond.
The iPhone in question was used by San Bernardino gunman Rizwan Farook, who along with his wife went on a shooting rampage in December that killed 14 and wounded 22.
The Justice Department wants Apple to help access encrypted information stored on Farook’s county-owned iPhone 5C by writing software that would disable its passcode protections to allow an infinite number of guesses without erasing the data on the device.
Apple has said the request amounts to asking a company to hack its own device and would undermine digital security more broadly.
“This would be bad for America. It would also set a precedent that I think many people in America would be offended by and when you think about those, which are knowns, compared to something that might be there, I believe we are making the right choice,” Mr Cook told ABC.
Some major tech companies have sided with Apple on the issue