(Reuters) - The U.S. government cannot force Apple Inc AAPL.O to unlock an iPhone in a New York drug case, a federal judge in Brooklyn said on Monday, a ruling that bolsters the company's arguments in its landmark legal showdown with the Justice Department over encryption and privacy.

3D printed Apple logo are seen in front of a displayed cyber code in this illustration taken February 26, 2016. REUTERS/Dado Ruvic/Illustration

The government sought access to the phone in the Brooklyn case in October, months before a judge in California ordered Apple to take special measures to give the government access to the phone used by one of the shooters in the San Bernardino, California, attacks.

U.S. Magistrate Judge James Orenstein in Brooklyn ruled that he did not have the legal authority to order Apple to disable the security of an iPhone that was seized during a drug investigation.

His ruling echoed many of the arguments that Apple has made in the San Bernardino case, particularly his finding that a 1789 law called the All Writs Act cannot be used to force Apple to open the phone. Orenstein also found that Apple was largely exempt from complying with such requests by a 1994 law that updated wiretapping laws.

A senior Apple executive, who spoke on condition he not be named, said during a call with reporters that Orenstein’s decision would bode well for the company in the San Bernardino case, which has touched off a fierce national debate about the balance between fighting crime and preserving privacy in the digital age.

He said that the government’s demands in the San Bernardino case, which include compelling Apple to alter its operating system, were even more far-reaching than in the NY case.

Although U.S. Magistrate Judge Sheri Pym, the judge in the San Bernardino case, will not be bound by Orenstein’s decision, the senior Apple executive said it will likely be influential. In both cases, the government relies on the All Writs Act, a broad 1789 law which enables judges to require actions necessary to enforce their own orders.

The Justice Department is “disappointed” in Orenstein’s ruling and plans to ask a higher judge within the same federal district to review the matter in coming days, a department representative said.

Though the defendant in the drug case has already pleaded guilty, the Justice Department still believes the phone may contain evidence that “will assist us in an active criminal investigation,” the official said.

When fighting the government’s order to help extract data from the iPhone, Apple had argued that being forced to do so “could threaten the trust between Apple and its customers and substantially tarnish the Apple brand,” according to court records.

Orenstein said his ruling in Apple’s favor was not a decision on “whether the government should be able to force Apple to help it unlock a specific device; it is instead whether the All Writs Act (AWA) resolves that issue and many others like it yet to come.”

Orenstein concluded that “the government posits a reading of the latter phrase so expansive – and in particular, in such tension with the doctrine of separation of powers – as to cast doubt on the AWA’s constitutionality if adopted.”

He also wrote: “The implications of the government’s position are so far-reaching – both in terms of what it would allow today and what it implies about Congressional intent in 1789 – as to produce impermissibly absurd results.”

Orenstein also found that Communications Assistance for Law Enforcement Act, passed in 1994, exempted Apple from this sort of request.

Amazon.com Inc AMZN.O, Alphabet Inc's GOOGL.O Google, Facebook Inc FB.O, Microsoft Corp MSFT.O and Twitter Inc TWTR.N have voiced support for Apple.

The iPhone 5s at issue in the case was seized by the U.S. Drug Enforcement Administration during a 2014 search of the Queens, New York, residence of Jun Feng, who authorities suspected of being involved in drug trafficking.

Authorities sought to access the phone in 2015 while the case was pending. Feng later pleaded guilty in October while Orenstein was weighing the request, but both Apple and the Justice Department said they still wanted a ruling.

Prosecutors have said that since 2008, Apple has complied with 70 such court orders based on the All Writs Act without objection. Many of those cases appear to have involved earlier iPhone models that did not require customized software to unlock.

The case before Brooklyn was, according to prosecutors, the first time Apple had objected to law enforcement efforts to utilize search warrants to get the tech company to provide assistance and unlock iPhones seized during investigations.

But since October, when Apple first asked Orenstein to deny the government’s request, Apple has objected to helping law enforcement access at least 12 devices for which the U.S. Justice Department has sought its help, according to a letter from Apple to Orenstein that was unsealed earlier this month.

The senior Apple executive said the company has never made a new piece of software in response to a government request.