Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

President Barack Obama signed the "USA Freedom Act" Tuesday, moving the storage of bulk telephone metadata used by the National Security Agency to telecom companies rather than the government.

Obama, who had said he would sign the bill as soon as possible, acted just hours after the measure passed the Senate by a 67-32 vote. He welcomed the Senate vote Tuesday, calling it "sensible reform legislation."

"After a needless delay and inexcusable lapse in important national security authorities, my administration will work expeditiously to ensure our national security professionals again have the full set of vital tools they need to continue protecting the country," Obama said.

He said the law strengthens civil liberty safeguards while "providing the American people with additional transparency measures."

Tuesday's actions brought to a close a dramatic multi-day showdown over civil liberties that made strange political bedfellows and united factions on the left and right ends of the ideological spectrum who are both skeptical of an overreaching government in a post-9/11 era.

"This legislation is critical to keeping Americans safe from terrorism and protecting their civil liberties," House Speaker John Boehner, R-Ohio, said in a statement. "I applaud the Senate for renewing our nation's foreign intelligence capabilities."

The Senate spent hours Tuesday fiercely debating whether to pass an amended version of the bill, which passed in the House on a 338-88 vote last month. In the Senate, where amendments need 51 votes to pass, lawmakers on both sides of the aisle worked to defeat any changes to the House bill.

Passing an amended version of the bill would have sent it back to the House, where its original co-sponsors said the chamber was unlikely to accept changes.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

One Senate amendment would have stymied efforts to allow "friends of the court" to address civil liberties issues before the Foreign Intelligence Surveillance Court in some cases. Another would have lengthened the transition time to move the bulk metadata collection program to telecom companies.

A Senate substitute to the broader bill, offered by Majority Leader Mitch McConnell, R-Kentucky, included a provision that would have required that a high-ranking intelligence official certify the readiness of surveillance programs after transitioning to telecom companies.

Those measures failed.

VIDEO: Sen. McConnell Opposes Bill that Weakens Counter Terrorism Tools https://t.co/yykMSnOdYK — Sen. McConnell Press (@McConnellPress) June 2, 2015

Sen. Rand Paul, R-Kentucky, introduced at least 10 amendments to the Senate substitute version of the bill. Republican leadership aides said none of them came to a vote because that would have required all 100 senators to agree, which was highly unlikely.

"If you amend the bill, you kill the bill," Dean Heller, R-Nevada, a Senate co-sponsor of the USA Freedom Act, said Tuesday. "I don't want the program to go away, but I think the USA Freedom Act is the correct way to go."

The inability to amend the bill marks a notable defeat for McConnell, who had lobbied hard to change the bill and send it back to the House. McConnell called the House bill a "resounding victory for those who are plotting against our homeland."

The highly controversial issue also put McConnell at odds with a political ally, Boehner, who ushered a bill through the House that passed with a majority of both Republicans and Democrats.

Related: Expiration Date: What's Next for the Patriot Act?

The National Security Agency’s authority to collect troves of bulk telephone metadata under the Patriot Act expired at midnight Monday, which the Obama administration said left the government with fewer tools in its arsenal to help thwart terrorism. Paul, who has been heavily campaigning for president on his stand against extending the bulk collection program, is unconvinced, as are civil liberties advocates who cite concerns about government overreach and privacy.

On Friday, The New York Times editorial board also advocated letting the Patriot Act provisions expire.

McConnell sought a two-week extension Sunday of two less controversial provisions, but Paul blocked that effort.

The most well-known of the lapsed provisions was “Section 215," which authorized the NSA's bulk collection of telephone metadata — information that includes who called whom when, but not what was said.

Two other programs — involving "roving wiretaps," which helps the FBI use warrants to track terrorism suspects who frequently switch cellphones, and a never-used program to monitor potential "lone wolf" suspects, who haven't been tied to terrorist groups — also expired. All three programs were established as a part of the Patriot Act, which was passed in 2001 in the wake of the Sept. 11 attacks, and any investigations that began before the sunset occurred can continue.

In recent days, the White House intensified efforts to influence public opinion. White House press secretary Josh Earnest said on MSNBC's "Morning Joe" that the administration has worked to reform the bulk collection program to better protect civil liberties while helping national security investigators.

"We've only got a few days," Obama said Friday. "These authorities expire on Sunday at midnight, and I don't want us to be in a situation in which, where for a certain period of time, those authorities go away and suddenly we're dark and, heaven forbid, we've got a problem where we could have prevented a terrorist attack or apprehended someone who was engaged in dangerous activity but we didn't do so simply because of inaction in the Senate."