The US House of Representatives narrowly approved continuing the National Security Agency's secret collection of hundreds of millions of Americans' phone records after a fierce debate pitting privacy rights against the government's efforts to thwart terrorism.
Wednesday night's 217-205 vote was unlikely to be the final word on government intrusion to defend the US and Americans' civil liberties.
A 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 the government's activities.
Republican Rep. Justin Amash had challenged the program as an indiscriminate collection of phone records, saying his effort was to defend the US Constitution and "defend the privacy of every American."
On Twitter, he vowed: "We fight on."
His measure, offered as an addition to a USD 598.3 billion defence spending bill for 2014, would have cancelled 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.
The House later voted to pass the overall defence bill, 315-109.
The issue created unusual political coalitions in Washington, with the Obama administration, national security leaders in Congress and the Republican establishment facing off against libertarian-leaning conservatives and some liberal Democrats.
The measure challenging the surveillance program faces strong opposition in the Senate and from the White House and is unlikely to survive in a final spending bill.
"Have 12 years gone by and our memories faded so badly that we forgot what happened on September 11?" Rep. Mike Rogers, the Republican chairman of the Intelligence committee, said in pleading with his colleagues to back the program.
With a flurry of letters, statements and tweets, both sides lobbied furiously in the hours prior to the vote in the Republican-controlled House.
The director of national intelligence, James Clapper, warned against dismantling a critical intelligence tool.
Since the September 11, 2001, attacks, Congress has authorised and a Republican and a Democratic president have signed an extension of the powers to search records and conduct roving wiretaps in pursuit of terrorists.