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.