If encrypted devices become inaccessible, he said, "that's a world we've never lived in in the United States and it has profound consequences for public safety."

But Comey also acknowledged that forcing Apple to help unlock the San Bernardino shooter's iPhone could set a precedent for other investigations.

"It is going to be potentially precedential, that's just the way the law works," he said in response to a question from Representative John Conyers, a Michigan Democrat.

The hearing comes amid an intense legal and political battle after Apple said it would challenge a court order to provide the FBI technical assistance to help break into the San Bernardino iPhone.

'Vicious guard dog'

Apple has argued the FBI is effectively asking the company to "hack" its own devices and create a "back door" that malicious actors could exploit.

Comey told the hearing that in his view, "it's not about back doors... there's already a door on that phone, we're asking Apple to take away the vicious guard dog."

Citizens' rights are protected by an independent judiciary, he noted, citing a longstanding principle that "if an independent judge finds reason to believe that certain private communications contain evidence of a crime, then the government can conduct a limited search."

Lawmakers from both parties appeared skeptical of the FBI efforts, questioning whether they could lead to weaker overall security in the future for new technologies.

"It won't really be a one-time request? It will set a precedent for the FBI and other law enforcement agencies?" asked the committee chairman, Virginia Republican Bob Goodlatte.

He also questioned whether Apple's creation of new software would "fall into the wrong hands and make everyone less secure."

Bypassing Congress

Conyers said that the FBI's legal efforts could be seen as an "end run" around the legislative process to step up its access to encrypted devices.

"I would be deeply disappointed if it turns out that the government is exploiting a national tragedy to pursue a change in the law," he said.

"This committee and not the courts is the place to consider the appropriate consequences."

Representative Trey Gowdy, however, offered strong support for the FBI, arguing that it is not for Apple to decide what is off-limits to a search.

"There are just going to be compartments of life where you are going to be precluded from everything... no matter how compelling the government's interest is."

In remarks prepared for the same hearing, Apple general counsel Bruce Sewell said the public should understand that "encryption is a good thing, a necessary thing" even if it makes the work of law enforcement more difficult.

"As attacks on our customers' data become increasingly sophisticated, the tools we use to defend against them must get stronger too," he said.

"Weakening encryption will only hurt consumers and other well-meaning users who rely on companies like Apple to protect their personal information."

Encryption helps preserve privacy around the world, he added, "and it keeps people safe."

Sewell repeated comments by Apple chief Tim Cook that the FBI is asking the company "to create an operating system that does not exist" and would open "a backdoor into the iPhone."