NSA-gathered intelligence also led American law enforcement to David Headley, a US citizen involved in a plan to bomb the office of a Danish newspaper that had published a cartoon of the Prophet Mohammed in 2006, and to an individual in San Diego who was providing financial support to Somali-based terrorists, said FBI Deputy Director Sean Joyce.

The House hearing was a generally friendly environment for US security officials and appeared to have been arranged to allow the executive branch a chance to reveal a bit more information in response to the Snowden leaks.

One of the NSA programs in question allows the agency to collect the metadata of US phone calls – numbers called and the duration of calls, the sort of information contained in phone bills. This metadata does not contain an individual’s identity, or the location from which calls were made, said Deputy US Attorney General James Cole.

“We don’t get any content,” said Mr. Cole. “This is under Section 215 of the Patriot Act, which has been reauthorized twice by Congress."

This collection only occurs pursuant to court orders. Officials need a further individualized, court-approved warrant to look at the data of a particular person. Its use is subject to extensive internal audits, including an annual inspector general report, and is described to Congress, said US officials.

The other program allows the NSA to collect the Internet activity of non-US persons who are not in the United States but whose web usage is handled by US-based servers, under authority of Section 702 of the Foreign Intelligence Surveillance Act. The Foreign Intelligence Surveillance Court has to approve all Section 702 actions.

“Section 702 cannot be and is not used to intentionally target any US citizen,” said NSA Deputy Director John Chris Inglis.

Mr. Inglis said that the Section 702 program was involved in 90 percent of the 50 thwarted plots. He added that it was analogous to spying on foreign nationals in their own countries, which is something US intelligence historically did as a national security matter without court oversight. Thus, the involvement of a court represents a “tightening” of oversight, he said.

The NSA does not get this web activity direct from the servers of Google, Facebook, and other Internet providers. The firms are “compelled” to provide information requested to the federal government, said Inglis.

Nor is the Foreign Intelligence Surveillance Court a “rubber stamp,” officials argued. They said the fact that virtually all 702 requests are approved is due to a process in which US intelligence agencies and FISC court staff discuss orders prior to their formal submission.

“The point is there is a multilevel layer of oversight,” said Robert Litt, general counsel in the office of the Director of National Intelligence.

According to the account provided in the House hearing, the New York subway plot was unraveled beginning in the fall of 2009, when the NSA intercepted an e-mail from a terrorist located in Pakistan pursuant to Section 702 authority. That person was communicating with an individual located in the US about recipes for explosives.

Through the legal process that person was identified as Najibullah Zazi, in Denver. Agents followed him to New York City. Subsequent search warrants turned up bombmaking components, and Mr. Zazi later confessed to a plot to bomb the city’s subway system with backpacks.

As to the New York Stock Exchange plot, NSA was using 702 authority to monitor a known extremist in Yemen. This extremist was in contact with an individual in the US named Khalid Ouazzani. Through further surveillance, the FBI discovered a nascent plot to bomb the NYSE.

“Ouazzani had been providing information and support to this plot,” said the FBI’s Sean Joyce.