Kevin McCoy

USA TODAY

NEW YORK — A federal judge in Brooklyn on Monday denied a Department of Justice request for a court order that would force Apple to bypass the security passcode on the iPhone of a criminal defendant in a drug case.

In a ruling expected to influence the outcome of Apple’s fight with the U.S. government over the San Bernardino killer’s iPhone, Magistrate Judge James Orenstein ruled government lawyers failed to establish that the federal All Writs Act the government relied on to seek the order applies in the case.

First Take: Apple-FBI fight may be custom made for Supreme Court

The question "is not whether the government should be able to force Apple to help it unlock a specific device; it is instead whether the All Writs Act resolves that issue and many others like it to come," he wrote. He concluded it did not.

The decision comes on the eve of Congressional testimony by Apple and the FBI to the House Judiciary Committee over encryption and privacy. In a high-profile dispute with the federal government, Apple says it will refuse an order by a judge in California that it unlock an iPhone used by one of the terrorists in the December shootings in San Bernardino, Calif., which left 14 dead. That's pitted the consumer device giant against the Department of Justice, which maintains Apple should help law enforcement on what it considers an isolated request.

Monday's ruling in New York marks a significant, if at least a temporary, legal victory for Apple, which has argued that it should not be forced to violate the privacy expectations of customers who buy its products.

Apple testimony: FBI asking to 'weaken' device security

The 50-page ruling on the New York request said Orenstein made the decision after weighing the relative closeness of Apple's relationship to the underlying criminal case and government investigation, the burden the requested order would place on the company and the "necessity of imposing such a burden on Apple."

None of those factors justifies imposing on Apple the obligation to assist the government's investigation against the company's will, he wrote.

The decision sets the stage for appeals that could eventually reach the U.S. Supreme Court.

"What today's ruling proves is that Apple's objections to the order aren't frivolous and indeed might well be meritorious," said Steven Vladeck, professor at American University's Washington College of the Law.

Apple plans two-pronged attack in fight with FBI

Department of Justice spokeswoman Emily Pierce issued a statement saying the government was disappointed by the ruling and plans to appeal it to a Brooklyn district court judge.

“Apple expressly agreed to assist the government in accessing the data on this iPhone — as it had many times before in similar circumstances — and only changed course when the government’s application for assistance was made public by the court," the government said.

The Brooklyn case centers on Jun Feng, a Queens, N.Y. defendant who pleaded guilty in October to a methamphetamine conspiracy. Investigators sought access to his iPhone 5 as they continued to investigate the alleged drug conspiracy.

However, the investigators risked being locked out and losing any chance to recover data stored on the phone if they too many unsuccessful attempts to bypass the built-in security passcode. As a result, they sought an order to compel assistance from Apple.

Apple faces 11 other orders for suspects' electronic data

The case is among roughly a dozen nationwide in which law enforcement authorities have sought similar court orders based on the All Writs Act.

Most prominently, the cases include the recent California federal court ruling that ordered the tech giant to help investigators break into the smartphone used by one of the shooters in December's San Bernardino terrorist attack.

Apple has appealed that order, and said the company would continue its objections in the other pending cases.

California Magistrate Judge Sheri Pym, who is presiding over the legal struggle for data on the iPhone of San Bernardino shooter Syed Rizwan Farook, would not be bound by the Brooklyn ruling. But both sides expect that Pym will consider the legal reasoning in Orenstein's ruling as the California case continues.

"This is a very important decision," Ryan Calo, a University of Washington law professor, said of the Brooklyn ruling. "Other courts, even in jurisdictions where it isn't binding, will look to this order and read the judge's reasoning and, though the exact context will be different, the principle that there are limits to what the All Writs Act can compel will be interesting to all cases involving this act."

Both the Brooklyn and San Bernardino cases are at early legal stages where arguments are heard by magistrate judges, who stand below district court judges in the federal court system. That could signal a lengthy appeal process, unless the case is fast-tracked by a higher court.

Contributing: Kevin Johnson in Washington, D.C. and Jessica Guynn in San Francisco.

Follow USA TODAY reporter Kevin McCoy on Twitter: @kmccoynyc.