SAN FRANCISCO — A federal court order requiring Apple Inc. to help law enforcement break into an encrypted iPhone belonging to one of the San Bernardino shooters has set the stage for a test case over the government’s ability to enlist technology companies in its investigations.

U.S. Magistrate Judge Sheri Pym in Riverside on Tuesday signed off on a government request to force Apple to unlock a passcode-protected iPhone belonging to Syed Farook, one of the two people who carried out last year’s mass shooting. Pym’s order requires Apple to develop software to defeat a security feature on the newest version of Apple’s iOS operating system that erases data after 10 consecutive unsuccessful passcode entries.

Apple CEO Tim Cook vowed to fight the order in a public letter to customers released late Tuesday night.

“The FBI may use different words to describe this tool, but make no mistake: Building a version of iOS that bypasses security in this way would undeniably create a backdoor,” Cook wrote. “And while the government may argue that its use would be limited to this case, there is no way to guarantee such control.”

Cook’s stance puts the encryption debate that had been playing out in Silicon Valley boardrooms and the halls of Congress before a federal judge. Pym’s order allows Apple to make the case that complying would be “unreasonably burdensome.”

Former federal prosecutor Jeffrey Bornstein, who is not involved in the case, said that government appears to be asking the court to compel Apple to develop a brand new tool to defeat the device’s security features. Bornstein, now a partner at Rosen Bien Galvan & Grunfeld, said that forcing the company to deploy its own resources and expertise “is different than forcing a company to turn something over that already exists.”

If Apple were to create the tool needed in this case, it could likely be used in every other case where law enforcement asks for similar assistance, he added.

Still, the San Bernardino case provides a challenging set of facts for Apple and its lawyers to stand on principle. Farook and his wife Tashfeen Malik killed 14 people in a nightmarish suburban shooting spree that appeared to be motivated by terrorist ideology. The couple died in a gun battle with police in December.

The phone that federal investigators are targeting was Farook’s work phone, and his former employer has consented to the search. According to the government’s court filings, the FBI attempted to work with Apple employees to access the phone’s data, but the company has refused to provide the technical work-around that the government proposes.

After being stymied in their own efforts, government investigators say they turned to Apple for help defeating the phone’s password protection.

Law enforcement officials appealed to Pym under the All Writs Act, an 18th century law that gives courts broad authority to issue orders that serve justice.

Esha Bhandari, a staff attorney with the American Civil Liberties Union, said that federal appellate courts haven’t weighed in on whether the All Writs Act grants government authority to force third-party tech companies to create back doors to devices that are no longer in the companies’ hands.

In a separate case pending in the Eastern District of New York, Apple, represented by Marc Zwillinger of ZwillGen in Washington, D.C., argued that the All Writs Act doesn’t allow the government to conscript companies as a would-be forensic experts. Federal prosecutors pointed out that the government had compelled Apple to assist in unlocking phones in 70 prior instances under the act.

The ACLU and the Electronic Frontier Foundation filed an amicus brief backing Apple. ACLU staff attorney Bhandari said Wednesday that the earlier cases that prosecutors pointed to involved older iPhones. In those earlier cases, Apple had existing software to help people who had forgotten their passcodes. That software no longer works on the versions of Apple’s operating system, she said.

UC-Hastings College of the Law professor Rory Little said that the All Writs Act isn’t frequently invoked to force private parties to assist in investigations but that it’s seen as a “catch-all” for getting a court order when there’s not a particular statute to point for authorization. But, Little added, that he finds it troublesome that the government might “comandeer” Apple software developers to develop a work-around to the company’s own measures for assuring customers that their personal information is secure.

The government has indicated in court filings that it would offer “reasonable reimbursement” to the company for its efforts. Apple has not yet filed new court papers in response to Pym’s ruling.

Contact the reporter at rtodd@alm.com.