The U.S. National Security Agency has reportedly ended its controversial practice of collecting Americans’ emails and texts sent and received by people overseas that mention foreigners targeted for surveillance, according to a report from the New York Times.

The decision marks the end of one of the NSA’s once-secret forms of warrantless wiretapping that had regularly come under fire by privacy advocates who believed the policy violated the Fourth Amendment’s prohibition on unreasonable searches.

Read: NSA Malware DoublePulsar: How To Test If Your Computer Has Been Infected

The practice did comply with Foreign Intelligence Surveillance Court, which determined it to be lawful, but allowed the government agency to intercept communications sent to and from Americans based on the content of the message rather than who sent or received it.

Some modifications have been made to the practice over the years, including a response to a 2011 court decision that found the NSA’s practice was in violation of the Fourth Amendment. At the time, internet companies would bundle messages and transmit them together, which would result in collecting messages sent and received domestically.

Despite the adjustments to the agency’s practices, the NSA was again found to have been collecting bundled messages in a way that violated the rules set forth by the court and resulted in a delay in the reauthorization of the warrantless surveillance program until the agency’s practices were again in compliance with the law.

National security officials have held a sender knowing the email address or phone number of a surveillance target is grounds for suspicion and argued that the surveillance practices are lawful and have produced results in identifying individuals who have links to terrorism and espionage, among other activities.

Read: NSA May Have Hacked Global Banks, Shadow Brokers Release Indicates

The change in practices marks a win for privacy advocates, who have argued the NSA data collection is too broad.

"The content of our emails and texts contains incredibly personal information about our work, our families, and our most intimate thoughts. The NSA should never have been vacuuming up all of these communications, many of which involved Americans, without a warrant,” Michelle Richardson, the deputy director of the Freedom, Security, and Technology Project at the Center for Democracy and Technology said in a statement.

“While we welcome the voluntary stopping of this practice, it's clear that Section 702 must be reformed so that the government cannot collect this information in the future."

Sen. Ron Wyden (D-Ore.) told the New York Times he intends to introduce new legislation that would put into law the new limitations on NSA surveillance.

“This change ends a practice that allowed Americans’ communications to be collected without a warrant merely for mentioning a foreign target,” Mr. Wyden told the New York Times. “For years I’ve repeatedly raised concerns that this amounted to an end-run around the Fourth Amendment. This transparency should be commended.”