The Senate approved legislation Tuesday to scale back the federal government’s collection of personal data in the post-9/11 era.

Under the USA Freedom Act, the National Security Agency’s bulk data collection program would be terminated, and phone companies would be responsible for retaining customer data.

The legislation amends the USA Patriot Act, which provides legal authority for key counterterrorism programs, including the phone surveillance initiative—whose powers were brought to light by the disclosures of Edward Snowden.

Some of those programs temporarily expired Monday after the Senate had failed to act on House-passed Freedom Act. Sen. Rand Paul, R-Ky., had blocked the measure from being voted on.

Supporters of the Freedom Act argue the legislation appropriately balances security and privacy. Some opponents of the legislation believe it is still too intrusive and violates civil liberties. Others, like Senate Majority Leader Mitch McConnell believe the amended program will put the nation’s security at risk by limiting key counterterrorism tools.

Several amendments that had been advocated by McConnell, R-Ky., to the House-passed bill failed.

McConnell said on the Senate floor that “I cannot support passage of the so called USA Freedom Act.”

“It does not enhance the privacy protections of American citizens. And it surely undermines American security by taking one more tool from our warfighters at exactly the wrong time,” McConnell said.

>>> Senate roll call vote for USA Freedom Act

Screen Shot 2015-06-02 at 9.38.37 PM

Sens. Ron Wyden, D-Ore., and Rand Paul, R-Ky., jointly introduced nine amendments to the Freedom Act. According to a press release by Wyden’s office, the senators were seeking to “strengthen privacy protections.”

In remarks on the Senate floor, Sen. Harry Reid, D-Nev., urged his colleagues to pass the bill so that the president could “sign it tonight.”

Speaking on the floor after the bill’s passage, Sen. Patrick Leahy, D-Vt., said Congress has ended the government’s bulk collection of data “once and for all.”

Wyden praised the Senate’s passage of the bill in a statement after the vote.

“It is not an exaggeration to say the passage of the USA Freedom Act is the most significant victory for Americans’ privacy rights in more than a decade, and stands as a true endorsement of the principle that Americans do not need to sacrifice their liberty to have security,” Wyden said.