The FBI has managed to unlock the iPhone of the San Bernardino gunman without Apple's help, ending a court case, the US justice department says.
Apple had been resisting a court order issued last month requiring the firm to write new software to allow officials to access Syed Rizwan Farook's phone.
But officials on Monday said that it had been accessed independently and asked for the order to be withdrawn.
Farook and his wife killed 14 people in San Bernardino in December.
They were later shot dead by police. US officials said Farook's wife, Tashfeen Malik, pledged allegiance to the so-called Islamic State on social media on the day of the shooting.
Last week, prosecutors said "an outside party" had demonstrated a possible way of unlocking the iPhone without the need to seek Apple's help.
A court hearing with Apple was postponed at the request of the justice department, while it investigated new ways of accessing the phone.
At the time, Apple said it did not know how to gain access, and said it hoped that the government would share with them any vulnerabilities of the iPhone that might come to light.
On Monday a statement by Eileen Decker, the top federal prosecutor in California, said investigators had received the help of "a third party", but did not specify who that was.
Investigators had "a solemn commitment to the victims of the San Bernardino shooting", she said.
"It remains a priority for the government to ensure that law enforcement can obtain crucial digital information to protect national security and public safety, either with co-operation from relevant parties, or through the court system when co-operation fails," the statement added.
Responding to the move, Apple said: "From the beginning, we objected to the FBI's demand that Apple build a backdoor into the iPhone because we believed it was wrong and would set a dangerous precedent. As a result of the government's dismissal, neither of these occurred. This case should never have been brought."
The company said it would "continue to increase the security of our products as the threats and attacks on our data become more frequent and more sophisticated".
An Israeli newspaper last week reported that data forensics experts at cybersecurity firm Cellebrite, which has its headquarters in Israel, are involved in the case.
Cellebrite told the BBC that it works with the FBI but would not say more.
Its website, however, states that one of its tools can extract and decode data from the iPhone 5C, the model in question, among other locked handsets.
The court order had led to a vigorous debate over privacy, with Apple receiving support from other tech giants including Google, Microsoft, and Facebook.
FBI director James Comey said it was the "hardest question" he had tackled in his job.
However, he said, law enforcement saved lives, rescued children and prevented terror attacks using search warrants that gave it access to information on mobile phones.