Handing Apple a key legal win in its intensifying conflict with the FBI, a federal judge in New York has rejected the government’s bid to force the Silicon Valley power to unlock an iPhone in a drug trafficking case.

In a 50-page ruling on Monday that is likely to bolster Apple’s position in a similar legal battle in the San Bernardino County terror probe, U.S. Magistrate Judge James Orenstein concluded that the government does not have the authority to force a company to crack its own security protections against its will, calling it “an unreasonable burden” on Apple.

The judge noted the 18th Century law invoked by the government to seek the order did not envision the type of debate now unfolding in the courts and in the public arena pitting government’s law enforcement and national security needs against the tech industry’s privacy protections.

“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 wrote. “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 likely to provide legal fodder to Apple’s side as the company and FBI square off in federal court in Riverside County over Apple’s refusal to comply with an order requiring it to unlock the iPhone of one of the San Bernardino County shooters. A federal magistrate there is scheduled to hold a hearing in the case on March 22.

Apple, backed by the tech industry, argues that the FBI’s demands threaten the privacy and security rights of millions of iPhone users around the world. The company recently disclosed in the Brooklyn case that it has already received at least a dozen requests to unlock iPhones since last fall, and an anticipates many more from the government if it loses in the courts.

U.S. Justice Department officials have downplayed Apple’s security arguments, contending the government is seeking technical help to aid in a crucial terrorism investigation that does not pose a wider threat to consumer privacy.

Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz