The National Security Agency will lose its authority at midnight to collect Americans' phone records in bulk, after an extraordinary Sunday Senate session failed to produce an 11th-hour deal to extend the fiercely contested program.

Intelligence officials warned that the outcome amounts to a win for terrorists. But civil liberties groups applauded the demise, at least temporarily, of the once-secret post-Sept. 11 program made public by NSA contractor Edward Snowden, which critics say is an unconstitutional intrusion into Americans' privacy.

The program is all but certain to be revived in a matter of days, although it also looks certain to be completely overhauled under House-passed legislation that Senate Majority Leader Mitch McConnell reluctantly blessed in an about-face Sunday evening. With most senators opposed to extending current law unchanged, even for a short time, McConnell said the House bill was the only option left other than letting the program die off entirely. The Senate voted 77-17 to move ahead on the House-passed bill.

But no final action was expected before Sunday's midnight deadline after McConnell's fellow Kentucky Republican Sen. Rand Paul served notice that he would assert his prerogatives under Senate rules to delay a final vote for several days.

"This is what we fought the revolution over, are we going to so blithely give up our freedom? ... I'm not going to take it anymore," Paul declared on the Senate floor, as supporters wearing red "Stand With Rand" T-shirts packed the spectator gallery.

McConnell countered: "We shouldn't be disarming unilaterally as our enemies grow more sophisticated and aggressive, and we certainly should not be doing so based on a campaign of demagoguery and disinformation launched in the wake of the unlawful actions of Edward Snowden."

Paul's moves infuriated fellow Republicans and they exited the chamber en masse when he stood up to speak after the Senate's vote on the House bill.

Sen. John McCain, R-Ariz. complained to reporters that Paul places "a higher priority on his fundraising and his ambitions than on the security of the nation."

In addition to the bulk phone collections provision, two lesser-known Patriot Act provisions also lapse at midnight: one, so far unused, helps track "lone wolf" terrorism suspects unconnected to a foreign power; the second allows the government to eavesdrop on suspects who continually discard their cellphones. The House bill, backed by the White House, extends those two provisions unchanged, while remaking the bulk collection program over six months by giving phone companies the job of hanging onto records the government could search with a warrant.

CIA Director John Brennan was among those warning that letting the authorities lapse, even for a time, will make America less safe.

Terrorists "are looking for the seams to operate within," Brennan said on CBS' "Face the Nation." ''This is something that we can't afford to do right now." He bemoaned "too much political grandstanding and crusading for ideological causes that have skewed the debate on this issue" and said the terrorism-fighting tools are important to American lives.

For Paul, the issue represents a potent political opportunity, and his presidential campaign has been sending out numerous fundraising appeals focused on it. A super PAC supporting him even produced an over-the-top video casting the dispute as a professional wrestling-style "Brawl for Liberty" between Paul and Obama — even though Paul's main opponent on the issue is McConnell.

The NSA already has begun winding down the phone collection program in anticipation that it will not be renewed. To ensure the program has ceased by the time authority for it expires at midnight, the agency planned to begin shutting down the servers that carry it out at 3:59 p.m. Sunday. That step was reversible for four hours but after that, rebooting would take about a day.