A judge in New York ruled Monday in favor of Apple in a case where investigators wanted the court to compel the company to unlock a seized iPhone 5S running iOS 7, which the company does have the ability to unlock.

This case involves a drug dealer who has already pleaded guilty. It pre-dates Apple's current battle with the government over a locked iPhone 5C that belonged to one of the shooters in the December 2015 terrorist attack in San Bernardino—that case is due to be heard in court next month in nearby Riverside, California.

By contrast, the San Bernardino case involves an iPhone 5c, running iOS 9, which Apple says it cannot unlock. In the California case, federal investigators asked for and received an unprecedented court order compelling Apple to create a new firmware to unlock the device. Last week, Apple formally challenged that order, and the outcome is pending.

However, on both coasts, Apple is fighting the government's attempt to use the same law, known as the All Writs Act—an obscure catchall statute that dates back to the 18th Century. There are several related AWA cases involving unlocking Apple devices that remain pending nationwide.

US Magistrate Judge James Orenstein ruled that what the government was asking for went too far.

The ruling, the first of its kind on the topic, has no legal bearing on the outcome of the California case as they are proceeding in different federal judicial districts. Apple hopes, however, that that Riverside judge will be "persuaded" by the decision, according to a company executive who was granted anonymity on a call with reporters.

As the judge wrote in his Monday ruling:

In short, whatever else the AWA's "usages and principles" clause may be intended to accomplish, it cannot be a means for the executive branch to achieve a legislative goal that Congress has considered and rejected. But because such rejection can take many forms, only one of which (and arguably the least likely in most circumstances) is outright prohibition, the government's argument here is manifestly irreconcilable with the statute.

The New York case began back in October 2015, when Judge Orenstein invited Apple to tell the court why it felt that the government could not compel it to unlock a seized phone. At the time, bringing Apple into a case like this was new.

Nine days later, defendant Jun Feng pleaded guilty to one count of conspiracy to distribute and possess with intent to distribute methamphetamine. Judge Orenstein then asked the government why the issue of Apple's compliance was not pointless given the guilty plea. In the government's own filing, dated October 30, 2015, prosecutors said that the investigation was not over and that it still needed data from Feng's phone.

If Feng's phone had iOS 8 or later installed—as 90 percent of iPhones do—this entire issue would likely be moot. Apple now enables full encryption by default, and the company specifically said the move happened "so it's not technically feasible for us to respond to government warrants for the extraction of this data from devices in their possession running iOS 8."

How far can you go?

Another key portion of the ruling showed that Judge Orenstein is particularly concerned with the government’s expansive view of this law, and addressed head-on the government’s assertion that because Apple licenses, rather than sells its software means that the company retains some amount of control over it.

As he wrote:

In a world in which so many devices, not just smartphones, will be connected to the Internet of Things, the government's theory that a licensing agreement allows it to compel the manufacturers of such products to help it surveil the products' users will result in a virtually limitless expansion of the government's legal authority to surreptitiously intrude on personal privacy. … But the concern about whether the AWA, as construed by the government, would confer on the judiciary an overbroad authority to override individual autonomy cannot be so easily avoided in this case. Nothing in the government's arguments suggests any principled limit on how far a court may go in requiring a person or company to violate the most deeply-rooted values to provide assistance to the government the court deems necessary.

Judge Orenstein also noted that he "deliberately" asked the government during oral arguments how far its interpretation of the All Writs Act could go. Could federal authorities, for example, compel the manufacturer of lethal injection drugs to make them over corporate moral objections?

The government didn’t answer during oral arguments, but said in a later filing that it would simply depend on the circumstances, which Judge Orenstein found unsatisfying.

"If the government cannot explain why the authority it seeks here cannot be used, based on the same arguments before this court, to force private citizens to commit what they believe to be the moral equivalent of murder at the government's behest, that in itself suggests a reason to conclude that the government cannot establish a lack of unreasonable burden," he concluded.

Orenstein’s opinion parallels arguments that Apple made in its San Bernardino filing just last week.

As its lawyers wrote then:

Finally, given the government’s boundless interpretation of the All Writs Act, it is hard to conceive of any limits on the orders the government could obtain in the future. For example, if Apple can be forced to write code in this case to bypass security features and create new accessibility, what is to stop the government from demanding that Apple write code to turn on the microphone in aid of government surveillance, activate the video camera, surreptitiously record conversations, or turn on location services to track the phone’s user? Nothing.

Headed for the Supreme Court?

Similarly, privacy law scholars roundly hoped that this case would exert some influence over the case pending before the court in California.

"It's a meticulous and scholarly opinion," Alex Abdo, an attorney for the American Civil Liberties Union, told Ars. "It should be a roadmap for any court considering one of these requests from the government."

Rep. Ted Lieu (D-Calif.), one of just four congressmen to hold a computer science degree, also applauded the ruling.

"I am very pleased with the decision, because it validates what I and others have been saying which is that Congress specifically rejected the FBI's proposal to put in backdoors to weaken encryption and now they're trying to do it through a 1789 law that is not appropriate for the situation," he told Ars.

The New York case could be appealed up to the 2nd Circuit Court of Appeals, and similarly, the California case could move up to the 9th Circuit Court of Appeals. If those appellate courts disagree with each other as to the limits of the All Writs Act, constituting a "circuit split," that probably would set the stage for a ruling at the nation's highest court.

"Ultimately, if the federal courts in California and New York disagree about how much authority the AWA gives the government to force Apple to unlock iPhones, the conflict could only be resolved by Congress clarifying the law or the Supreme Court settling it," Neil Richards, a law professor at Washington University in St. Louis, told Ars.