House members were deeply divided Wednesday over whether the National Security Agency's secret collection of hundreds of millions of Americans' phone records should continue.

They finally rejected ending the program by a narrow vote of 217-205.

The issue made unusual alliances that essentially boiled down to libertarian-leaning conservatives and liberal Democrats pressing for the change against the Obama administration, the Republican establishment and Congress' national security experts.

Those who wanted the program stopped argued that the NSA program threatened Americans’ right to privacy, while those who wanted it to continue said it was crucial to national security.

One of the Republicans who sided with Democrats in voting for such surveillance to end was Idaho Republican Raul Labrador, who joked about the lawmakers who crossed party lines to vote similarly.

“I call it jokingly the wing nut coalition,” Labrador said in discussing himself and others who support the amendment. “Justin is the chief wing nut.”

Labrador was referring to Republican Rep. Justin Amash of Michigan, chief sponsor of the repeal effort, who said his aim was to end the indiscriminate collection of Americans' phone records.

Others who voted “yes” to halt the NSA program include Democrats Xavier Becerra, of California, Raul Grijalva, of Arizona, and Linda and Loretta Sanchez of California. Those who voted “no” to halting the program include Republicans Mario Diaz-Balart and Ileana Ros-Lehtinen, both of Florida, and Democrats Joaquin Castro of Texas, Albio Sires of New Jersey, and Luis Gutierrez of Illinois.

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 the government's activities.

Backing the NSA program were 134 Republicans and 83 Democrats, including House Speaker John Boehner, R-Ohio, who typically does not vote, and Democratic leader Nancy Pelosi. Rejecting the administration's last-minute pleas to spare the surveillance operation were 94 Republicans and 111 Democrats.

It is unlikely to be the final word on government intrusion to defend the nation and Americans' civil liberties.

"Have 12 years gone by and our memories faded so badly that we forgot what happened on Sept. 11?" Rep. Mike Rogers, R-Mich., chairman of the Intelligence Committee, said in pleading with his colleagues to back the program during House debate.

Amash’s 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.

The House later voted to pass the overall defense bill, 315-109.

Amash told the House that his effort was to defend the Constitution and "defend the privacy of every American."

"Opponents of this amendment will use the same tactic that every government throughout history has used to justify its violation of rights: Fear," he said. "They'll tell you that the government must violate the rights of the American people to protect us against those who hate our freedom."

The unlikely political coalitions were on full display during a spirited but brief House debate.

"Let us not deal in false narratives. Let's deal in facts that will keep Americans safe," said Rep. Michele Bachmann, R-Minn., a member of the Intelligence committee who implored her colleagues to back a program that she argued was vital in combatting terrorism.

But Rep. Jim Sensenbrenner, R-Wis., a senior member of the Judiciary Committee who helped write the Patriot Act, insisted "the time has come" to stop the collection of phone records that goes far beyond what he envisioned.

Several Republicans acknowledged the difficulty in balancing civil liberties against national security, but expressed suspicion about the Obama administration's implementation of the NSA programs — and anger at Director of National Intelligence James Clapper.

"Right now the balancing is being done by people we do not know. People who lied to this body," said Rep. Mick Mulvaney, R-S.C.

He was referring to Clapper who admitted he gave misleading statements to Congress on how much the U.S. spies on Americans. Clapper apologized to lawmakers earlier this month after saying in March that the U.S. does not gather data on citizens — something that Snowden revealed as false by releasing documents showing the NSA collects millions of phone records.

With a flurry of letters, statements and tweets, both sides lobbied furiously in the hours prior to the vote in the Republican-controlled House. In a last-minute statement, Clapper warned against dismantling a critical intelligence tool.

Since the Sept. 11, 2001, attacks, Congress has authorized — and a Republican and a Democratic president have signed — extensions of the powers to search records and conduct roving wiretaps in pursuit of terrorists.

Two years ago, in a strong bipartisan statement, the Senate voted 72-23 to renew the Patriot Act and the House backed the extension 250-153.

The Associated Press contributed to this report.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino