WASHINGTON -- A National Security Agency reform bill failed to clear a key procedural hurdle in the Senate on Tuesday night, torpedoed by opposition from Senate Minority Leader Mitch McConnell (R-Ky.) and talk of the threat from the Islamic State.

Senators voted 58 to 42 to advance debate on the USA Freedom Act, which is meant to end the NSA's controversial domestic call tracking program. The bill thus failed by two votes to invoke cloture, the procedural step that precedes a simple majority vote in the Senate.

"Don't let this get bogged down in procedural flimflam that the American public hates," pleaded the bill's sponsor, Sen. Patrick Leahy (D-Vt.), during the cloture debate. But Leahy's request went unheeded.

Organizations as diverse as Facebook, the American Civil Liberties Union and the National Rifle Association had all endorsed the bill. But the intelligence agencies' allies in Congress fought to kill or weaken it, as they succeeded in doing with a companion House measure that passed in May.

McConnell lashed out at the bill in remarks on the Senate floor earlier Tuesday, arguing that its passage would help the Islamic State, also known as ISIL, and other terrorist groups trying to evade U.S. detection.

"God forbid that tomorrow we wake up to the news that a member of ISIL is in the United States," echoed Sen. Marco Rubio (R-Fla.). Without the NSA's call tracking program, he said, "that plot may go forward -- and that would be a horrifying result."

"Let's not have another repeat of 9/11," added Sen. Dan Coats (R-Ind.).

But Leahy pointed out that the NSA has never been able to show that the call tracking program, which aroused much controversy after it was exposed by leaker Edward Snowden in June 2013, has actually stopped a terror plot against the United States.

"If this was important to stop ISIL, ISIL never would have started," said Leahy.

Democrats and the handful of Republicans who crossed party lines to support the bill argued that it struck a proper balance in protecting liberty while still allowing the NSA to collect phone records with a court order.

Sens. Mike Lee (R-Utah), Dean Heller (R-Nev.) and Ted Cruz (R-Texas) all voted to advance the measure. They have aligned themselves with the GOP's libertarian wing on this issue by co-sponsoring the bill.

"It is imperative that we stand together protecting the Bill of Rights," said Cruz.

Alaska Republican Lisa Murkowski voted for the bill and Florida Democrat Bill Nelson voted against it. But the measure was doomed for want of two additional Republican supporters. One likely candidate would have been Sen. Rand Paul (R-Ky.), who has also sought to paint himself as a libertarian opponent of the NSA. But Paul voted against cloture on the bill, claiming that it did not go far enough to rein in the Patriot Act.

Paul's objection to the bill helped ensure the demise of Leahy's last-ditch effort to get NSA reform passed this year.

"Rand Paul has a lot of explaining to do," tweeted Kevin Bankston, a supporter of the bill at the New America Foundation's Open Technology Institute, after the bill failed.

Now NSA reform will likely be delayed until 2015, when the provision of the Patriot Act that authorizes the call tracking program sunsets at the end of May.