The U.S. Justice Department's efforts to compel Apple to provide the FBI with access to a locked iPhone in the San Bernardino terror investigation could set a precedent for future cases, FBI Director James Comey said Tuesday.

Comey, testifying before the House Judiciary Committee about the encryption debate, acknowledged that other prosecutors and lawyers would likely look to the outcome of the San Bernardino case.

"Any decision about a court is particularly useful to another court," Comey said.

During his testimony, Apple General Counsel Bruce Sewell said that the FBI is asking the tech giant to weaken the security of its products. Sewell said, however, that Apple would comply with the court’s order to unlock the iPhone if the court process ends in the government’s favor on the issue, according to Reuters.

Comey disputed that the Justice Department was requesting a "key" to open the iPhone, one which Apple has argued could not remain secure.

"There's already a door," Comey said. "Take the vicious guard dog away and let us pick the lock. I have a lot of faith in the company's ability to secure their info."

Comey's testimoney comes a day after the Justice Department suffered a setback when a federal judge ruled Apple could not be forced to provide the FBI with access to a locked iPhone's data in a Brooklyn drug case.

U.S. Magistrate Judge James Orenstein's written decision provided support to Apple's decision as it fights a California judge's order to create specialized software to help the FBI hack the San Bernardino phone.

The San Bernardino County-owned iPhone 5C was used by Syed Farook, who along with his wife Tashfeen Malik, killed 14 people during an attack on Dec. 2 that was at least partly inspired by ISIS. Farook worked for the country as a health inspector.

Apple on Thursday formally objected to the order in a brief filed with the court.

The company's opposition to the government's tactics has evoked a national debate over digital privacy rights and national security.

Orenstein concluded that Apple is not obligated to assist government investigators against its will and noted that Congress has not adopted legislation that would achieve the result sought by the government.

"How best to balance those interests is a matter of critical importance to our society, and the need for an answer becomes more pressing daily, as the tide of technological advance flows ever farther past the boundaries of what seemed possible even a few decades ago," Orenstein wrote. "But that debate must happen today, and it must take place among legislators who are equipped to consider the technological and cultural realities of a world their predecessors could not begin to conceive."

"We are disappointed in the Magistrate's ruling and plan to ask the District Judge to review the matter in the coming days," a Justice Department spokesman said in a statement. "As our prior court filings make clear, Apple expressly agreed to assist the government in accessing the data on this iPhone -- as it had many times before in similar circumstances -- and only changed course when the government's application for assistance was made public by the court.  This phone may contain evidence that will assist us in an active criminal investigation and we will continue to use the judicial system in our attempt to obtain it."

Attorneys for Apple and company officials said they were still reading opinion and will comment later.

In October, Orenstein invited Apple to challenge the government's use of a 227-year-old law to compel Apple to help it recover iPhone data in criminal cases.

The Cupertino, California-based computer maker did, saying in court papers that extracting information from an iPhone "could threaten the trust between Apple and its customers and substantially tarnish the Apple brand."

It followed up by declining to cooperate in a dozen more instances in four states involving government requests to aid criminal probes by retrieving data from individual iPhones.

Federal prosecutors say Apple has stopped short of challenging court orders judicially, except in the cases before Orenstein and the California jurist who ruled about the San Bernardino shooter's phone.

"Ultimately, the question to be answered in this matter, and in others like it across the country, is not whether the government should be able to force Apple to help it unlock a specific device; it is instead whether the All Writs Act resolves that issue and many others like it yet to come," Orenstein wrote. "For the reasons set forth above, I conclude that it does not."

Several tech companies have already voiced their concern about creating so-called “backdoors” into encrypted devices for government.

“My experience in security technology tells me that the creation of the firmware in question would give away enough blueprint for government (and the hackers who have demonstrated proficiency at hacking government) to exploit millions of other iPhones,” wrote Pravin Kothari, CEO of cloud security specialist CipherCloud, in a statement emailed to FoxNews.com. “I believe that national security and privacy can and should co-exist. As a civilian, I rely on the government to protect us within the rule of law."  

Fox News' Matt Dean and The Associated Press contributed to this report.