The US Senate voted against reining in the NSA's spying powers tonight, shooting down a proposal that was supported not just by intelligence reform groups, but by the director of the NSA himself.

The USA Freedom Act needed 60 Senate votes to pass its key procedural vote, and it failed to get them. The bill got 58 yes votes and 42 no votes.

The bill would have stopped the government from engaging in bulk phone surveillance. Instead, Americans' phone information would have remained with the phone companies and could only be searched by request, with specific selection terms.

It would have also provided for a privacy advocate at the Foreign Intelligence Surveillance Court, which approves such surveillance. Reformers hoped that would provide for a less one-sided debate at that court.

The bill had widespread support, not just from civil liberties groups but from law enforcement—including the director of the NSA and even former Director of National Intelligence James Clapper.

There are many other aspects of surveillance that came up since the Snowden leaks that the bill didn't address, such as surveillance of e-mail that was revealed as part of the PRISM program. It would have extended for two years certain aspects of the Patriot Act, such as "roving" wiretaps.

Supporters: Stop "secret courts, secret laws"

"Our bill protects Americans," said Sen. Patrick Leahy (D-VT), who introduced the bill. "It ends indiscriminate data collection, but keeps the tools our intelligence community needs to protect the nation."

Leahy again publicly debunked the reports that the bulk collection program had thwarted over 50 terrorist plots. "It may have possibly helped on one," he pointed out.

Opponents of the bill said the threat of terrorism necessitated the database.

"God forbid tomorrow morning we wake up to the news that a member of ISIL is in the United States," said Sen. Marco Rubio (R-FL).

The bulk collection program currently in place would allow intelligence agencies to quickly get their contacts, he said.

"We can disrupt that cell, before they can carry out a horrifying attack that kills hundreds of people," said Rubio.

"This bill advances the cause of safeguarding our nation, without in any way detracting from our security," said bill supporter Sen. Richard Blumenthal (D-CT). "The founding fathers would have been shocked if they had heard of warrants being issued by a secret court, making secret law."

Opponents: A "needed tool" for fighting terror

Sen. Dianne Feinstein, a longtime opponent of intelligence reform, made a surprising change of vote and pleaded with her colleagues to support the bill. She remains a defender of the program, pointing out that there were only 288 queries for metadata in 2013.

However, Feinstein felt if the bill didn't pass, it could lead to the program being thrown out altogether.

"If we didn't pass the House bill, there were members that wanted to end the whole program," said Feinstein. "I do not want to end the program. I'm prepared to make the compromise, which is that the metadata will be kept by the telecoms."

Feinstein said that she and Sen. Saxby Chambliss (R-GA), the leading Republican on her intelligence committee, contacted four large telecom companies asking whether they would agree to keep the records needed. Two said they already were, and the other two ultimately committed to keeping the records for two years.

While Feinstein made a strategic switch, Chambliss wasn't prepared to do so. The existing program helps do things like find out if a group like ISIL is recruiting Americans, he said.

"We have any number of people, committed to jihad, that live in America," said Chambliss on the Senate floor. "This program gives the intelligence community all the tools they need to make sure that when ISIL recruits individuals, if they're Americans, we can find out about that."

After the vote, Leahy criticized the tone of the debate, lamenting "those who resort to scare tactics."

"Fomenting fear stifles serious debate and constructive solutions," he said. "This nation should not allow our liberties to be set aside by passing fears. America will always face the threat of terrorist attacks, from both outside our borders and inside."

He added that he won't give up the fight to pass this bill, or another like it.

"I swear that, to the Vermonters I serve and the Constitution I swore an oath to defend," said Leahy.

A roll call of votes shows that 41 of the 42 votes against the bill were cast by Republicans, with only four senators from that party voting to move the bill forward.