The FBI has shrugged off growing congressional anxiety over its surveillance of US citizens, claiming such programs could have foiled the 9-11 terrorist attacks and would prevent "another Boston".

The FBI director, Robert Mueller, also revealed that US authorities would be taking action against whistleblower Edward Snowden for revealing the extent of its activities, confirming that the FBI and department of justice were taking "all necessary steps to hold the person responsible".

But Mueller's testimony before the House judicial oversight committee brought angry responses from many congressmen, who questioned whether such surveillance was lawful and demanded to know why it had failed to prevent the Boston bombing if it were so effective.

In a frequently heated debate over balancing privacy and security, Mueller went further than other government officials in claiming that the collection of data on all American phone calls had become an essential part of counter-terrorism efforts and would make the US "exceptionally vulnerable" if watered down.

He also rejected calls from technology companies such as Google to disclose the scale of the programs, saying even this information could help terrorists seeking to hide their communications.

"If you narrow [the scope of surveillance], you narrow the dots and that might be the dot that prevents the next Boston," said Mueller.

He described how Khalid al-Midhar, one of the 9-11 hijackers, had called a Yemeni safe house from a phone in San Diego shortly before the attack – a phone call that would have been intercepted and acted upon, claimed Mueller, had today's surveillance system been in place.

Not all committee members were convinced however, particularly in the light of acknowledged intelligence failures before the Boston attacks – when phone records were available. "I am not persuaded that makes it OK to collect every phone call," said Democrat John Conyers.

Others questioned whether the FBI had acted lawfully in seeking to use section 215 of the Patriot Act to target all calls made in the US on the basis that they "might become relevant" to future terrorism investigations.

"A dragnet subpoena for every telephone record makes a mockery of the relevance standard under [section] 215," said Democrat Jerrold Nadler. "If everything in the world is relevant, then the word has no meaning."

Jason Chaffetz, a Republican from Utah, questioned whether by collecting so-called "metadata" from call records, the FBI was contravening a recent legal test case that found that tracking a suspect's movements without a warrant infringed fourth amendment rights to privacy under the constitution.

Mueller claimed basic telephone call records were not subject to fourth amendment protection under a 1979 Supreme court judgment, but declined to comment on whether they now included geo-location data, saying the "question had not occurred" to him and this "may or may not" amount to a form of call content.

Republican Louis Gohmert also pushed back at the FBI, accusing it of over-classifying surveillance. But Mueller told him to "ask that question in a classified briefing" and said it would be dangerous to reveal the content of secret Fisa court judgments that approved such activities under section 215 of the Patriot Act.

This brought an angry response from Jim Sensenbrenner, one of the authors of the Patriot Act, who said: "My concern is there is no way for anyone whose records have been turned over to you to get the order quashed because they don't know about it."

But Mueller insisted that any disclosures of the extent of its surveillance activities risked harming national security.

"Any tidbit of information that comes out" about how authorities track communications means terrorists "find ways around", he said.

"Every time we have a leak like this and you follow it up and look at the intel afterwards [you find terrorists] are looking for ways around.. If we lose our ability to get their communications we are going to be exceptionally vulnerable"

The FBI director also claimed that such collection of electronic data had been a vital part of efforts track down Ibragim Todashev, a friend of the Boston bombers recently shot dead in Florida. He did not say whether phone or computer records used would have been available to the authorities without recourse to blanket collection of phone records, although it is highly likely a specific subpoena would have been granted in the wake of the attack, which killed three people.