Rep. Justin Amash, R-Mich. walks through a basement tunnel to the House of Representatives on Capitol Hill, Wednesday, July 24, 2013. / J. Scott Applewhite, AP

by Jim Michaels, USA TODAY

by Jim Michaels, USA TODAY

WASHINGTON â?? The Obama administration and National Security Agency narrowly averted an embarrassing setback Wednesday as the House defeated an attempt to block the collection of massive volumes of telephone records on domestic calls.

By a 217-205 vote, the House defeated a proposal by Rep. Justin Amash, R-Mich., that would have limited the collection of so-called metadata by the NSA.

The proposal was among the first significant challenges to a program that has drawn scrutiny after a former NSA contract employee leaked details of it.

While unsuccessful, Amash drew together a diverse coalition of libertarian Republicans, law-and-order conservatives and liberals, who all said they were troubled by the NSA's collection of data on people who were not under criminal investigation.

The amendment, which was attached to a defense spending bill, would have required the government to show any collection of data is related to a specific individual.

Critics of the amendment said it would deal a death blow to a critical intelligence program that has helped disrupt planned terrorist attacks.

Disclosures by Edward Snowden, the NSA contract employee, have brought fresh scrutiny to the collection of so-called metadata. The data includes phone numbers and the duration of the calls, but not the substance of the calls.

Amash said his proposal would only stop the government from sweeping up data indiscriminately but would not interfere with the pursuit of legitimate terrorism investigations.

His proposal drew immediate criticism from the Obama administration and key lawmakers. "This blunt approach is not the product of an informed, open, or deliberative process," White House spokesman Jay Carney said in a statement.

"It ends the program," said Rep. Tom Cotton, an Arkansas Republican and former paratrooper in Iraq. "It blows it up."

Sen. Dianne Feinstein,D-Calif., chairman of the Senate Intelligence Committee and Mike Rogers, chairman of the House Intelligence Committee, opposed the amendment.

Will Adams, an aide to Amash, said the breadth of the opposition from political leaders is proof that the amendment would be effective in stopping the indiscriminate collection of data.

"People with a stake in the program have come out with guns blazing against it," he said.

Critics say the NSA programs violate privacy and go beyond what was intended by the Patriot Act, which was designed to expand the ability of the government to investigate and prosecute terrorism cases.

Gen. Keith Alexander, head of the NSA, has said the collection of data has helped disrupt dozens of terrorist plots. Investigators are not allowed to comb through the data, but can use it when they have identified a foreign suspect through other intelligence collection.

The data allows investigators to then detect networks the suspect may have been tied into, which could lead to other suspects and the uncovering of secret cells.

"The court restricts what we can do with that data," Alexander said in a recent speech. "We have to show some reasonable, articulable suspicion that the phone number that we're going to look at is associated with al-Qaeda or another terrorist group."