The US Justice Department does not have the authority to force Apple to unlock an iPhone involved in a Brooklyn drug case and hand the data over to the FBI, a New York judge ruled Monday.

In this case, the FBI was applying the same 18th century legislation that it argues must compel Apple to unlock the iPhone belonging to one of the shooters in the San Bernardino massacre.

Breaking: Judge Orenstein just ruled in favor of Apple in Brooklyn case. Says AWA doesn't apply to this case. pic.twitter.com/Po00z6k6sX — Jenna McLaughlin (@JennaMC_Laugh) February 29, 2016

“The government has failed to establish” that the All Writs Act permits it to make Apple provide access to data stored on a locked iPhone, US Magistrate Judge James Orenstein wrote in the ruling. He also stated that if the AWA does allow the FBI to make such an order, “discretionary factors” in the case compelled him to reject the motion.

The AWA of 1789 established the federal justice system and enabled federal judges to order third parties to assist the government.

Read more

In July of 2015, federal authorities looked to obtain a warrant to search an iPhone belonging to Jun Feng, a New Yorker charged with conspiracy to traffic in methamphetamine. However, Judge Orenstein gave Apple the chance to contest the government’s argument that it had the power to force the company to unlock the mobile device, and he ultimately decided that law enforcement’s argument wasn’t good enough to place the burden of unlocking the phone on Apple.

While the drug case that Orenstein ruled on is unrelated to the San Bernardino one, it’s nevertheless a significant victory for Apple as it continues to argue that it cannot be forced by law enforcement to create a “back door” into encrypted devices.

Earlier this month, Apple was ordered to help law enforcement crack an encrypted phone that belonged to San Bernardino gunman Syed Rizwan Farook by writing software that would enable authorities to bypass the built-in security. Apple has argued that the AWA has never been used to make companies create new software to aid the government.

The company has asked the courts to vacate the order, arguing that breaking into the phone would help create a back door that could be exploited against other devices and compromise individual privacy.

For its part, the government says it is not asking Apple to create a back door into all phones. Rather, it simply wants help getting into this particular phone.

According to the AP, Apple has declined to help the government unlock encrypted iPhones in more than a dozen cases across multiple states, leaving the question for courts to consider.

In his opinion on Monday, Orenstein noted that Congress has also yet to pass laws affirming the government’s authority to make technology companies bypass encryption.

"How best to balance those interests is a matter of critical importance to our society, and the need for an answer becomes more pressing daily, as the tide of technological advance flows ever farther past the boundaries of what seemed possible even a few decades ago," Orenstein ruled. "But that debate must happen today, and it must take place among legislators who are equipped to consider the technological and cultural realities of a world their predecessors could not begin to conceive."

The ruling is unlikely to mark the end of the debate, however. the Justice Department said it intends to appeal the decision.