Congress gave final approval Tuesday to the most sweeping rollback of government surveillance powers in the post-Sept. 11 era, clearing the way for a new program that bans the National Security Agency from collecting and storing Americans' telephone dialing records.
The Senate's 67-32 vote reflected growing concerns about privacy, but also increasing unease among lawmakers that Sunday's abrupt expiration of the surveillance program, caused by congressional deadlock, posed a national security risk.
The new system allows intelligence agencies to access the same kind of call records, but only by requesting the information from telephone companies with a court order.
"It's a historic moment," said Sen. Patrick J. Leahy (D-Vt.), who had championed the bill. "It's the first major overhaul of government surveillance laws in decades. It adds significant privacy protections for the American people. It's been a long and difficult road, but I'm proud of what the U.S. Congress has achieved today."
President Obama quickly signed the USA Freedom Act, which had already passed the House.
"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 earlier Tuesday.
First disclosed by former NSA contractor Edward Snowden in 2013, the NSA surveillance program sparked a national debate over where to draw the line between Americans' privacy rights and the fight against terrorism.
The government had been secretly collecting millions of phone records in its pursuit of terrorists since 2001. The information did not reveal the contents of conversations, but included phone numbers dialed, calls received and the time and duration of calls.
Obama had sought to reform the program, which was enacted during the George W. Bush administration after the Sept. 11 attacks.
But Obama kept it running while Congress struggled to agree on reforms. Last month a federal appeals court ruled that the NSA's bulk collection program lacked legal authority.
Cynthia Wong, senior Internet researcher at Human Rights Watch, said the legislation's passage marked "what could be a turn of the tide against mass surveillance. Although the bill's reforms are only a modest first step, this is the first time Congress has affirmatively restrained the NSA since the attacks of Sept. 11."
Almost all Democrats supported the reform bill, but Republicans, including the 2016 GOP presidential candidates, were deeply split, yet another expression of the divide between the party's traditional defense hawks and libertarian-leaning newcomers.
Among those running for president, Sen. Rand Paul (R-Ky.), who sought to terminate the program entirely and helped force its expiration Sunday, voted against the bill, as did Sen. Marco Rubio (R-Fla.).
Sen. Ted Cruz (R-Texas) voted in favor. Sen. Lindsey Graham (R-S.C.) did not vote.
The bill will allow the NSA to temporarily restart its collection program, giving the government six months to switch to the new system. The NSA has said such a timeline is sufficient.
Tuesday's vote was not without a final standoff, as Senate Majority Leader Mitch McConnell (R-Ky.) — who fought unsuccessfully to renew the previous NSA program without change — sought some last-minute amendments.
One would have required the director of national intelligence to certify that a new system was up and running before abandoning the old program. It also would have required the phone carriers to notify the government of any changes in the way they collect and store the information. Usually, data are kept for 18 months.
"Nobody's civil liberties are being violated here," a visibly frustrated McConnell said Tuesday. "Before scrapping an effective system that has helped protect us from attack in favor of an untried new one, we should at least work toward securing some modest degree of assurance that the new system can in fact actually work."
But he faced opposition in the House, which had reached a fragile bipartisan compromise that supporters said respected civil rights while still providing adequate surveillance tools to track terrorists.
"My advice is to take this bill and pass it and send it to the president to keep America safe," said House Majority Leader Kevin McCarthy (R-Bakersfield).
With concern mounting after the NSA program had been dark for more than 36 hours, senators rejected the amendments, which could have prolonged the debate deeper into the week.
"If members of Congress, particularly Republican members of Congress, ever want to improve their standing among the American people, then we must abandon this habit of political gamesmanship," said Sen. Mike Lee (R-Utah). "It's time for us to pass this bill."
Dismissal of the amendments was another setback for McConnell, who had previously failed to persuade his colleagues to approve even a short-term extension of the NSA authority.
Paul said little after the vote, but released a new campaign ad focusing on his efforts to shut down the program.
Sen. Tom Cotton (R-Ark.), among the new generation of defense hawks, said the reform bill "returns us to a dangerous pre-9/11 mind-set at a time when America is still at war with radical Islam."
The bill also would reauthorize other parts of the Patriot Act that have been less contested, including the "lone wolf" provision, which allows the government to apply for court permission to wiretap an individual suspected of terrorist activities who is not part of a larger group, and another that allows the government to conduct "roving wiretaps" as suspects switch phones.
Sen. John Cornyn of Texas, the No. 2 GOP leader, voted for the bill and said it was preferable to a continued standoff.
"While the USA Freedom Act is not perfect nor my preference, it is better than allowing our intelligence agencies to continue operating in the dark."