WASHINGTON — The House narrowly rejected a challenge to the National Security Agency’s secret collection of hundreds of millions of Americans’ phone records Wednesday night after a fierce debate pitting privacy rights against the government’s efforts to thwart terrorism.
The vote was 217-205 on an issue that created unusual political coalitions in Washington, with libertarian-leaning conservatives and liberal Democrats pressing for the change against the Obama administration, the Republican establishment, and national security experts.
The showdown vote marked the first chance for lawmakers to take a stand on the secret surveillance program since former NSA systems analyst Edward Snowden leaked classified documents last month that spelled out the monumental scope of some of the government’s activities.
‘‘Have 12 years gone by and our memories faded so badly that we forgot what happened on Sept. 11?’’ Representative Mike Rogers, Republican of Michigan and chairman of the Intelligence committee, said in pleading with his colleagues to back the program during House debate.
His Republican colleague from Michigan, Justin Amash, was the chief sponsor of the repeal effort.
His measure, offered as an addition to a $598.3 billion defense spending bill for 2014, would have canceled the statutory authority for the NSA program, ending the agency’s ability to collect phone records and metadata under the USA Patriot Act unless it identified an individual under investigation.
Amash told the House that his effort was to defend the Constitution and ‘‘defend the privacy of every American.’’
Among the eight members of the all-Democratic delegation from Massachusetts, only Joseph P. Kennedy III of Brookline voted against stripping the NSA of wide-ranging powers.
The overall defense spending bill would provide the Pentagon with $512.5 billion for weapons, personnel, aircraft, and ships plus $85.8 billion for the war in Afghanistan for the next budget year.