The Justice Department withdrew its legal action against Apple, Monday, confirming that an outside method to bypass the locking function of a San Bernardino terrorist’s phone has proved successful.

The method brought to the FBI earlier this month by an unidentified entity allows investigators to crack the security function without erasing contents of the iPhone used by Syed Farook, who with his wife, Tashfeen Malik, carried out the December mass shooting that left 14 dead.

“The government has now successfully accessed the data stored on Farook’s iPhone and therefore no longer requires the assistance from Apple Inc.,” Justice lawyers said in a two-page filing in a California federal magistrate’s court.

Justice spokeswoman Melanie Newman said the FBI is reviewing the contents of the phone, “consistent with standard investigatory procedures.”

“We will continue to pursue all available options for this mission, including seeking the cooperation of manufacturers and relying upon the creativity of both the public and private sectors,” Newman said.

Apple had no immediate comment.

Justice officials declined to comment on whether the technique used to unlock the phone would be applied to other encrypted devices. Authorities also refused comment on whether the method would be shared with Apple.

Asked whether the tenor of the litigation had irreparably damaged the government’s relationship with the tech giant, one senior law enforcement official said the “goal has always been to work cooperatively’’ with the company.

Monday’s action culminates six weeks of building tensions. The FBI insisted for weeks that only Apple could crack the contents of Farook’s iPhone. Apple said such an action amounted to a digital “backdoor” that could eventually undermine the privacy of consumers — an unwavering stance supported by Google, Facebook, Microsoft and other tech giants.

Since a federal magistrate in California in mid-February ordered Apple to assist the FBI in gaining access to Farook’s seized iPhone, the legal filings and rhetoric between the world’s most valuable technology company and the federal government’s premier law enforcement agency had sharpened into verbal vitriol. The foes were poised to  face off in a court room in Riverside, Calif., last week before the Justice Department abruptly asked for — and was granted — a postponement.

Apple CEO Tim Cook has called the request to override the passcode encryption akin to creating a “backdoor” into the iPhone, and crusaded in a highly coordinated public campaign against the dangers of weakened security in digital devices. This month, Apple said the “Founding Fathers would be appalled” because the government’s order to unlock the iPhone was based on what it said was non-existent authority asserted by the DOJ.

The tech industry has stood behind Apple, which in court documents said the government’s order was “neither grounded in the common law nor authorized by statute.”

Government law enforcement officials have denied charges the FBI wanted to establish a backdoor to Apple’s encryption, and swatted away accusations that they were using the case to gain broader access to consumers’ devices.

“The San Bernardino case was not about trying to send a message or set a precedent; it was and is about fully investigating a terrorist attack,” FBI Director James Comey wrote in an editorial last week.