The Senate on Tuesday blocked a bill to end bulk collection of Americans' phone records by the National Security Agency, dealing a blow to President Barack Obama's primary proposal to rein in domestic surveillance.

The 58-42 vote was two short of the 60 needed to proceed with debate under Senate procedural rules. Voting was largely along party lines, with most Democrats supporting the bill and most Republicans voting against it. The Republican-controlled House had previously passed its own NSA bill.

The legislation would have ended the NSA's collection of domestic calling records, instead requiring the agency to obtain a court order each time it wanted to analyze the records in terrorism cases, and query records held by the telephone companies. In many cases the companies store the records for 18 months.

The revelation that the spying agency had been collecting and storing domestic phone records since shortly after the terrorist attacks of Sept. 11, 2001, was among the most significant by Edward Snowden, a former agency network administrator who turned over secret NSA documents to journalists. The agency collects only so-called metadata — numbers called, not names — and not the content of conversations. But the specter of the intelligence agency holding domestic calling records was deeply disquieting to many Americans.

The bill had drawn support from technology companies and civil liberties activists. Its failure means there has been little in the way of policy changes as a result of Snowden's disclosures.

Pressured to act, Obama in January proposed curbing the NSA's authority and the House in May passed a bill to do so. While the measure was pending, the NSA continued to collect American landline calling records, though the program does not cover most mobile phone records.

The law authorizing the bulk collection, a provision of the post-9/11 USA Patriot Act, will expire at the end of 2015. That means Congress would have to pass legislation re-authorizing the program for it to continue.

For that reason, Democratic Sen. Dianne Feinstein, the chairman of the Senate Intelligence Committee, abandoned her previous opposition to the bill. "If we do not pass the bill, we will lose this program," Feinstein said on the Senate floor.

"This bill increases trust and confidence and credibility of our intelligence system," said Democratic Sen. Richard Blumenthal.

But Sen. Saxby Chambliss, the ranking Republican on the Intelligence Committee, called the bill "totally flawed" and said the NSA needs the ability to sift through domestic calling records and hold the records. "We have under surveillance any number of Americans who are committed to jihad," Chambliss said.

Republican Sen. Marco Rubio said the bill "gutted" a program that could successfully unravel domestic terror plots. If there is another terror attack on US soil, he said, "I promise you the first question we will be asked is why didn't we know about it and why didn't we prevent it."

One of the few Republicans to support the measure was Sen. Ted Cruz , who said, "This legislation protects the constitutional right to privacy."

Current and former intelligence officials disagree about whether the phone record searching is a crucial counterterrorism tool. The US has only been able to point to a single case that came to light exclusively through a search of domestic phone records— an Anaheim, California, cab driver who was sentenced earlier this year to six years in prison for sending money to Somalia's Al Qaeda affiliate.

As it stands, officials have said, the program is not gathering most cell phone billing records, which account for an increasing share of domestic phone calls. Under both the House and the Senate bills, the NSA would have been able to query those records, provided the agency can work through the technical hurdles.

Get the Monitor Stories you care about delivered to your inbox. By signing up, you agree to our Privacy Policy

Laura W. Murphy, director of the American Civil Liberties Union's Washington Legislative Office, expressed disappointment in the Senate's action.

"Allowing NSA surveillance to continue unchecked does real harm to Americans," she said in a statement. "Constant surveillance violates the Fourth Amendment, chills free speech, imperils freedom of the press, and is an affront to the Constitution. Tonight the Senate voted to maintain a status quo that undermines American technology and consumer privacy and hampers innovation. Though this vote is a setback, it will not stop the push for reform."