Sunday night marked the first time that Congress has limited the executive branch’s surveillance authority since the terror attacks in 2001 set off a dystopian explosion in the government’s ability to spy on people inside and outside its borders.

But it was not so much a glorious moment of constitutional rebalancing for the legislative branch as it was parliamentary farce as usual. Faced with the long-planned expiration at midnight of three contentious provisions of the Patriot Act, the Republican-controlled Senate was simply unable to get it together and vote to renew the surveillance powers.

That failure to act was consequential. One of the three provisions had been used — improperly, it turns out — as legal justification for a National Security Agency program that collected phone records on millions of Americans without a warrant or any probable cause, along with other business records.

So as of today, for the first time in 14 years, you can make phone calls without the NSA hoovering up the records of who you called and for how long.

Of course, it wasn’t until two years ago, when NSA whistleblower Edward Snowden released a trove of top-secret documents to journalists, that Americans even knew this was happening.

The domestic bulk-collection program, which quickly emerged as an outlier among the programs Snowden revealed, rested on a legal interpretation of a statute that redefined the word “relevant” as meaning “everything.” It was ostensibly authorized by the Patriot Act despite the fact that the law’s author, who didn’t know it was being used that way, vociferously objected as soon as he found out. It has repeatedly been determined to be illegal, not only by legal experts and blue-ribbon panels, but just last month by a federal appellate court. It has had no documented positive impact on national security. And it represented a wildly unprecedented leap into domestic spying by an agency whose mandate has historically been foreign.

Its end was inevitable ever since milquetoast compromise reform legislation, called the USA Freedom Act, passed the House in an overwhelming bipartisan vote on May 13. That bill puts in place a replacement program that leaves phone records in the possession of the telecom companies until the NSA comes with a specific request. It also reauthorizes two other expiring provisions of the Patriot Act, one of which makes it easier to track suspects who frequently change phones; the other, which has never actually been used, allows the government to begin surveillance on individuals without asserting a connection to a specific terrorist group.

In a reflection of how viscerally opposed hardliner Senate Republicans are to doing anything that would officially vindicate Snowden, however, Senate Majority Leader Mitch McConnell engaged in epic legislative theatrics right up to the eve of the sunset, even going so far as bringing the Senate back early from its Memorial Day recess for an extraordinary Sunday night session, with the goal of somehow reinstating the program in full.

But you can’t put the genie back in the bottle.

McConnell finally caved to reality with just hours to go, dropping his opposition to the USA Freedom Act, and allowing a vote on whether to proceed with it. That vote was 77-17.

By that point, however, Sen. Rand Paul, R-Ky., was on a tear, his opposition to Fourth Amendment violations supercharged by a need to call attention to his flagging presidential campaign.

Paul prevented the Freedom Act from passing before the midnight deadline — but with the cloture vote a done deal, a final vote is expected mid-week.

Some privacy advocates celebrated the rollback, even briefly, of the three provisions in their entirety.

The Internet advocacy group Fight for the Future and progressive nonprofits CREDO and Demand Progress declared in a joint statement: “The expiration of key Patriot Act provisions — even if only temporary — is a victory for the countless civil liberties activists in every congressional district in the country who, since Edward Snowden blew the whistle on government surveillance, have fought for real reform. It demonstrates that the public can win battles in Congress that just a few years ago we were barely able to fight at all.”

The groups said the “fake-reform” Freedom Act is “an attack on civil liberties and codifies some of the worst mass surveillance abuses of the Patriot Act.”

By contrast, the White House, which saw the Freedom Act as “a reasonable compromise balancing security and privacy,” called on the Senate “to ensure this irresponsible lapse in authorities is as short-lived as possible.”

Sen. Ron Wyden, D-Ore., split the difference. “Tonight the collection of phone records of millions of innocent Americans will end,” he said in a statement. “The demise of this dragnet surveillance is a victory for the principle that Americans do not need to sacrifice liberty to have security.”

Now, he added, Congress “has the opportunity to build on this victory by making meaningful and lasting reforms” by passing the Freedom Act.

Leading Democratic surveillance hawk Dianne Feinstein was hyperbolic. “The need for investigators to collect intelligence on known or suspected terrorists can’t be overstated,” she said in a statement that exaggerated the impact of the provisions. “Our national security — not to mention the safety of all Americans — is at stake.”

Sunday night featured open warfare between Paul and the current leaders of his party, particularly McConnell and Sen. John McCain, R-Ariz.

“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,” McConnell said.

Paul may have burned some bridges when he said of his critics: “Some of them I think secretly want there to be an attack so they can blame it on me.”

Stanford legal scholar Jennifer Granick wrote before Sunday’s vote that the Senate shouldn’t rush to pass the Freedom Act as is. It “was negotiated at a time when straight reauthorization was a real danger” and before the appellate court decided bulk collection is illegal. The bill is “now rather anemic,” she wrote.

And, she noted, “there’s a clear and present danger that if [the Freedom Act] passes, everyone will pat themselves on the back for a job well done … and it’ll be suspicionless spying as usual until the next big surveillance provision, section 702 of the FISA Amendments Act sunsets at the end of 2017, and we’re in the same position again.”

Her proposal: “Let’s have hearings, really understand all the spying being done in our name, how the information is being used. Let’s set up real, comprehensive, robust checks and balances, starting with declassifying interpretations of law and changing the role of the FISA judges.”

More likely, however: McConnell will try to water it down some more before a final vote.

Photo: C-SPAN