Justice Department said it has the passcode to unlock a drug dealer’s iPhone. (Carolyn Kaster/AP)

For the second time in less than a month, the Justice Department has backed off using the courts to force Apple to help it gain access to a locked iPhone in an investigation.

On Friday, it told a federal court in Brooklyn that it no longer needs Apple’s help in pulling data from a drug dealer’s iPhone after someone came forward with a passcode.

In California last month, the government abandoned a bid to compel Apple’s assistance in helping unlock a terrorist’s iPhone after a third party sold the FBI a method to crack the device.

In both cases the government had asserted Apple was the only one who could provide the technical assistance.

Legal analysts and industry lawyers are divided on whether the discovery of alternatives undermines the Justice Department’s case in seeking similar court orders in the future.

“It’s going to be a much tougher putt for the government the next time this happens,” said Craig A. Newman, a partner at Patterson Belknap who chairs the firm’s data privacy group. “The Justice Department has now shown that workarounds exist without forcing Apple to break into its own devices. Intentionally or not, the bar just got higher, and the government will be hard-pressed to argue again that Apple is its only alternative.”

But Michael Sussmann, a partner at Perkins Coie who represents tech firms, disagreed. “There will be phones the government just can’t gain access to, and they’ll be able to say truthfully, ‘We need the data, and we have no way to access it,’ ” he said. “The fact that in these two cases they found a way in, or got lucky, won’t change that.”

Nonetheless, said Ira Rubinstein, a senior fellow at New York University School of Law’s Information Law Institute, “In future cases, the government may have to show it has exhausted alternative methods of breaking into a locked device.” Rubinstein, former associate general counsel at Microsoft, added that the court may wish to hear from independent security researchers before deciding whether to compel an unwilling firm to provide assistance.

Since October, when the government sought an order from a federal judge in Brooklyn, Apple has received at least 11 similar court orders directing it to help the government gain access to information on locked iPhones. It objected to the orders and has not heard from the government since. Google also has received orders to help federal agents retrieve data from encrypted cellphones, according to the American Civil Liberties Union.

FBI officials said they have recovered more than 3,000 phones in criminal investigations in the past six months. They have been unable to extract data from about 400, or about 13 percent, of those phones.

All the orders for assistance cited the All Writs Act, a little-known law that has vaulted into prominence with the Apple case. The Justice Department has cited a 1985 decision that found that the All Writs Act is a source of authority to issue writs “not otherwise covered by statute.”

Part of the test for granting an order under the law is whether there is any alternative way to achieve the same goal, noted James Garland, a partner at Covington & Burling, whose clients include tech firms.

“I’m sure the Justice Department was telling the truth when they told the courts they were unable to unlock these phones, so it’s not exactly the boy who cried wolf,” said Garland, a former senior department official. “But the fact that they subsequently figured out how to do it — without Apple’s help — may well give courts pause before issuing similar orders in the future.”

In Brooklyn, an unnamed individual on Thursday evening provided the passcode to the government, which was then able to gain access to the iPhone, U.S. Attorney Robert L. Capers wrote in a one-paragraph submission on Friday to Judge Margo K. Brodie in the Eastern District of New York.

Justice Department spokeswoman Emily Pierce said officials were not releasing the individual’s name because the investigation is ongoing.

Apple stated in a filing this month that the government had made “no serious attempt” to obtain the phone’s passcode from the drug dealer. The Silicon Valley firm had no comment on the Brooklyn development.

The California case, which stemmed from the December terrorist attack in San Bernardino, attracted worldwide attention as the first major legal showdown between the government and Apple over gaining access to an encrypted phone. Apple portrayed the Justice Department’s effort to force compliance as setting a dangerous precedent. The government rejected that characterization.

“As we have said previously, these cases have never been about setting a court precedent,” Pierce said. “They are about law enforcement’s ability and need to access evidence on devices pursuant to lawful court orders and search warrants.”

Until recently, Sussmann noted, “Apple vs. the FBI was shaping up to be the tech battle of the century.” But the government last month backed down from the legal fight in California. Then on Friday, he said, “the second front in that campaign ended with a whimper, too. The government is obviously bringing every non-legal tool and resource to bear on unlocking encrypted iPhones, but these successes can’t last, and a return to the courts won’t be far off.”