The US Senate has voted to limit the government's ability to collect phone data, a policy that had been in place since the attacks of 11 September 2001. The USA Freedom Act extends the government's ability to collect large amounts of data, but with restrictions.
The bill, which replaces the Patriot Act, had been backed by President Barack Obama as a necessary tool to fight terrorism. Mr Obama later signed the bill into law.
The new law undoes a national security policy that had been in place since shortly after the attacks on 11 September 2001. It replaces a National Security Agency (NSA) program in which the spy agency collected personal data en masse.
The revelation of this program by former NSA contractor Edward Snowden triggered a global public backlash.
Instead of receiving bulk quantities of data from telephone and internet companies the NSA will now be forced to request the information through a court order. The data will also be stored on telephone and internet company servers rather than government servers.
The request must be specific to an individual entity such as a person, account, or electronic device. A six-month transition will be in place as the policy shifts so that data storage remains with private companies, rather than on government servers.
The law's passage had been temporarily blocked by libertarian-minded senators who are fearful of government's intrusion into individuals' private lives.
Kentucky senator and presidential hopeful Senator Rand Paul repeatedly criticized the bill from the Senate floor.
We are not collecting the information of spies. We are not collecting the information of terrorists. We are collecting all American citizens' records all of the time, Mr. Paul said. This is what we fought the revolution over.
President Obama had earlier criticized Congress for the needless delay and inexcusable lapse in important national security authorities.
The Freedom Act had been approved by the House of Representatives and the White House but the Senate rejected it last week by a vote of 57-42. Once it became clear that the Patriot Act extension would not be possible, senators voted to move forward with the Freedom Act.
Republican Senate Leader Mitch McConnell, also from Kentucky, fought to prevent any rollback in surveillance powers. Speaking on the floor of the Senate Mr McConnell said the law will take one more tool away from those who defend our country every day.