Ordering Apple to access data against its will would be akin to making a reluctant drug company carry out a lethal injection, a US judge has said.
Judge James Orenstein was hearing a US government request to make it retrieve information from a locked iPhone seized by law enforcement officers.
On Monday, the judge expressed doubt that he had the authority to do so.
Apple has agreed to similar requests previously but is now refusing, saying it would erode customers' trust.
Referring to the US Department of Justice's request for him to order Apple to help it unlock the phone, the judge said: "What you're asking [Apple] to do is do work for you."
And he compared the request to a hypothetical one in which the government was asking him to order a drug company to take part in an execution against its conscientious objection.
He asked the department's lawyer, Saritha Komatireddy, whether or not he would have the legal authority to do so.
Ms Komatireddy asked to respond in writing, adding that the hypothetical was "somewhat inflammatory".
"Purposefully so," the judge responded.
Apple has argued that the order the government is seeking would be burdensome, in part because of the erosion of its customers' trust.
The company also said it lacked the technical ability to unlock phones running its newer operating systems, iOS8 and iOS9, though the phone at issue in the case runs an older system.
Ms Komatireddy questioned whether unlocking the phone would really be a burden for Apple, noting the company "has been doing this for years without any objection".
The judge pressed Apple's lawyer, Marc Zwillinger, to explain the company's change of heart.
Mr Zwillinger said the company had become more concerned about customer data in light of recent high-profile data breaches.
"Right now, Apple is aware that customer data is under siege from a variety of different directions," he said.
The judge asked both sides to submit additional letters addressing his questions to the court by Wednesday and said he would rule as soon as he could.
Ms Komatireddy said at the hearing that the US Drug Enforcement Administration and the FBI were taking part in the underlying investigation, which is not public.