In a midnight session, the Senate has voted down the USA Freedom Act, putting one of the legal bedrocks of the NSA's bulk surveillance programs into jeopardy. The Patriot Act is set to expire at the end of the month, and the USA Freedom Act would have extended large portions of the act in modified form. Tonight's failure to arrive at a vote makes it likely that many of those powers will automatically expire, although Senate Majority Leader McConnell (R-KY) scheduled a last-minute session on May 31st for one last shot at passing the bill.

In particular, the USA Freedom Act would have modified the Section 215 of the Patriot Act, a clause that allows the FBI to secretly order the collection of "tangible things" that could help in a national security investigation. Since its passage, Section 215 has been interpreted loosely — and likely illegally — by intelligence agencies. As whistleblower Edward Snowden revealed in 2013, the definition of both "tangible things" and "investigation" was broad enough to let NSA build a large database of American phone records for an ongoing, expansive national security effort.

After the program was discovered, President Obama ordered the NSA to get approval before searching the database, but the phone metadata orders have still been renewed every three months. Government reports have said that there's little evidence the phone records program foiled any terrorist plots, however, and a recent court decision found that it wasn't legal at all by the standards of Section 215.

Bye extra transparency. Bye FISA advocate. Bye 214, NSL reform. Sunset the bastard. — Amie Stepanovich (@astepanovich) May 23, 2015

The provision has also been used for tracking more than phone records. This week, the Justice Department's Office of the Inspector General released a review of Section 215. While it's partially redacted, the document describes FBI requests for records that "range from reproductions of hard copy reproductions of business ledgers and receipts to gigabytes of metadata and other electronic information," including email records. This might not necessarily be problematic in itself, but the report notes that requests could cover "groups composed of unknown members" and people who weren't actually associated with investigations, with the justification that they were still relevant to the investigation.

Originally, the USA Freedom Act was a relatively broad reform bill, tightening the language of national security rules and adding more transparency requirements. Since its introduction, though, it had been revised several times — a watered-down version passed the House last year, and a stronger version died in the Senate. The House brought a new version of bill back and passed it earlier this month, but the bill faced significant opposition in the Senate. Most notably, Rand Paul has staged a series of non-procedural filibusters in symbolic opposition to the bill, including a speech today that pushed the Senate vote past midnight.