The FBI on Friday 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 iPhone 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 a handset 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." 

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.

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 deadly December 2 attacks in San Bernardino.

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.