FBI director James Comey, pictured on March 1, 2016, said his agency found an outside party that appeared to have the ability to extract data from the iPhone without Apple's help

The FBI Thursday defended the handling of its legal battle with Apple over encryption following an abrupt retreat from its bid to force the tech giant to help unlock an attacker's iPhone.

FBI director James Comey said his agency only decided to back down from its efforts after it found an outside party that appeared to have the ability to extract data from the handset without Apple's help.

Comey made the comments in a statement, which was also posted as a letter to the Wall Street Journal, responding to an editorial critical of the government's handling of the investigation into an iPhone used by one of the shooters in last year's deadly attacks in San Bernardino, California.

"You are simply wrong to assert that the FBI and the Justice Department lied about our ability to access the San Bernardino killer's phone," Comey wrote.

"I would have thought that you, as advocates of market forces, would realize the impact of the San Bernardino litigation. It stimulated creative people around the world to see what they might be able to do. And I'm not embarrassed to admit that all technical creativity does not reside in government. Lots of folks came to us with ideas. It looks like one of those ideas may work and that is a very good thing."

FBI vs Apple

He added that the case "was not about trying to send a message or set a precedent; it was and is about fully investigating a terrorist attack."

The Justice Department asked for a postponement a day before a critical hearing before a California judge on the effort to force Apple to provide technical assistance.

The Journal said the government's handling of the case offered "reasons to doubt their credibility and even basic competence."

The editorial said the Justice Department's legal effort was "reckless" and that the FBI "fibbed by saying the Apple case is about one phone."

Other backers of Apple's position have also questioned the government's tactics and claimed the move was aimed at using the case to build public support for increased surveillance.

Evan Greer of the activist group Fight for the Future said this week that "even before this latest announcement, multiple expert security researchers have cast serious doubt on the DOJ's claim that only Apple could help unlock the phone."

Federal prosecutors and Apple spent weeks trading a volley of legal briefs related to the FBI's demand that the tech company help investigators unlock the phone used by Syed Farook, who died in a shootout after the December 2 shooting in San Bernardino that left 14 people dead and was the deadliest terror attack in the US since 9/11.

Several news reports have said the FBI may be using an Israeli forensics company that has developed a technique to transfer data out of the iPhone without deleting the contents.

At a news conference Thursday announcing indictments of alleged hackers linked to Iran, Comey said the FBI decided to pause efforts after "someone came forward with an idea."