The effort to force approval on the Keystone XL project went down to defeat last night, but it didn’t die alone. Outgoing Judiciary chair Pat Leahy has spent the last year working on a plan to reform laws controlling the NSA and had reached agreement with Republican James Sensenbrenner in the House on a joint bill. It wasn’t good enough to get past a cloture vote, though, falling two short of the hurdle:

The Senate on Tuesday failed to get the 60 votes needed to advance a bill that would stop the National Security Agency from collecting the phone records of millions of Americans who are not suspected of any crime.

Senators voted 58-42 in favor of a motion to allow the USA Freedom Act to come to an up or down vote in the Senate. The motion required 60 votes to pass.

The bill is effectively dead for this year and is unlikely to be revived when the new Congress convenes in January. However, the controversial NSA program will most likely be debated again next year as Congress decides whether to renew sections of the Patriot Act anti-terrorism law that are set to expire in June.

The Freedom Act would have brought an end to the NSA’s mass collection of phone data more than a year after the program was revealed by former NSA contractor Edward Snowden.

Mitch McConnell had opposed the reform bill for going too far in restricting NSA’s abilities, especially while the threat from ISIS keeps growing. Resistance came from a more surprising source, though, as fierce NSA critic Rand Paul voted against cloture. Paul concluded that the bill didn’t go far enough:

But with the country engaged in military operations with the Islamic State in Iraq and Syria, a majority of Republicans rallied against the Freedom Act. Minority Leader Mitch McConnell, Florida Sen. Marco Rubio and others suggested the bill could make Americans more vulnerable to terrorist attacks.

Sen. Rand Paul, who has long criticized the NSA, also voted against the measure. Last week, Paul’s office said the Kentuckian will oppose the measure because it does not go far enough and would renew a portion of the post-9/11 USA Patriot Act, which grants the government expansive spying powers.

The measure earned Republican support from Sens. Ted Cruz, Mike Lee, Dean Heller and Lisa Murkowski.

Paul later explained that he “couldn’t stomach” the reauthorization of PATRIOT Act provisions in the bill, but The Daily Beast notes that those are the provisions Leahy and Sensenbrenner were trying to reform. They cast the decision instead more as a 2016 test between Paul and Cruz, who was one of the bill’s co-sponsors:

But the bill would have also reauthorized several PATRIOT Act provisions until 2017, which Paul said he couldn’t stomach.

“They put something good in a bill that I find objectionable,” Paul told The Daily Beast before Tuesday’s vote. “They could take out the [PATRIOT Act] reauthorization, then I’ll vote for the bill.”

Paul’s framing of the bill is somewhat misleading: most sections of the PATRIOT Act don’t have an expiration date, and don’t need to be reauthorized. The USA Freedom Act would have extended an expiring authority that allows the NSA to search business records, while reforming it to end bulk surveillance and allow tech companies to hold data, rather than the government.

But as Olivia Nuzzi and Tim Mak also note, Paul’s decision was no surprise either. He has been arguing against the bill for its compromises for a while, even as the libertarian magazine Reason warned Paul that he was making a mistake. If this is presidential politics, though, it’s an odd way for them to play out, especially on the Republican side. To the extent that the NSA scandal would be determinative among grassroots conservatives (as opposed to libertarians), it might be Cruz’ position that would be most appreciated — reform while trying to protect national security. Paul seems to be more purist than mainstream libertarians in demanding the whole loaf or nothing at all.

Interestingly, one Democrat also voted against cloture, Bill Nelson of Florida. Only the Huffington Post bothers to even mention Nelson’s vote, and no one has offered an explanation of it. One libertarian activist demanded an explanation from Paul over his opposition, but so far no one seems to be demanding one from Nelson. Perhaps if the cloture had failed by one vote rather than two, there would have been more scrutiny on Nelson, but … that should be true of Paul as well.

The USA Freedom Act is now dead until the next session. Leahy moves to the minority, which means Chuck Grassley will have to take up NSA reform starting in January, putting its direction under Republican control. Rand Paul will probably like that result less than this effort, and it will be interesting to see whether Republicans can make up whatever votes they lose in the Democratic caucus from within their own without Paul’s endorsement.