WASHINGTON — The House on Friday passed a defense spending bill with an amendment that would bar the National Security Agency from conducting warrantless searches of its databases for Americans’ communications records.

Although the NSA is permitted to acquire without individualized warrants the communications of foreigners overseas, it has also been allowed to search those records for the communications of Americans in what some lawmakers have called a “backdoor search loophole.”

The amendment, adopted late Thursday night by a wide margin, would ban that practice. The provision would also prohibit the government from requiring companies to alter their hardware or software products to assist the NSA or CIA with electronic surveillance.

The two-thirds bipartisan vote, sponsors say, is a signal to the intelligence community and its House supporters that a reform package passed in May did not go far enough. It comes a year after disclosures about NSA surveillance have stoked debate about the proper balance between privacy and national security and how far to rein in government surveillance powers.

Despite opposition from Intelligence and Judiciary committee leaders, the amendment’s liberal and libertarian sponsors marshalled 293 votes in favor of the amendment to the 2015 Defense Appropriations bill. Opposed were 123 lawmakers.

The overall bill passed 340 to 73 Friday and heads to the Senate, where the amendment’s prospects are uncertain.

“It’s a huge statement that we in the House on a bipartisan basis believe that the Fourth Amendment has not been repealed and needs to be applied in the NSA arena when it comes to searches of Americans,” said Rep. Zoe Lofgren, D-Calif., an amendment cosponsor and a Judiciary Committee member whose district includes Silicon Valley, home to tech firms that have been urging greater restrictions on surveillance.

But C.A. Dutch Ruppersberger of Maryland, the ranking Democrat on the Intelligence Committee, who represents the district where the NSA is headquartered, said the amendment would make Americans less safe. “It would prohibit the urgent search of lawfully collected information to thwart a bomb plot against a synagogue in Los Angeles, a church in Maryland or the New York Stock Exchange,” he said on the floor Thursday night.

The amendment applies to data collected under a 2008 law known as the FISA Amendments Act, which permits the government to acquire without individualized warrants the communications of foreigners who are reasonably believed to be located overseas, if the data meets a valid foreign intelligence purpose.

In 2011, the Foreign Intelligence Surveillance Court lifted a ban on searching the data collected without a warrant on the communications of Americans. The government has been searching that data since then.

Government officials contend that they are not required to obtain a warrant to search data they have acquired lawfully. To do so would impair intelligence investigations, they say.

A measure to restore the ban was included in original legislation called the USA Freedom Act. But it was removed from the package as part of a compromise to win the support of Judiciary Committee Chairman Bob Goodlatte, R-Va. The bill was further modified, including some last-minute changes to accommodate the needs of the intelligence community. It passed 303 to 121 in May, also a significant margin.

During the past year, as revelations by former NSA contractor Edward Snowden fueled debate, the administration has shifted. In January, President Barack Obama called for an end to the NSA program to collect the data. The USA Freedom Act would do that, but critics say it has loopholes that nonetheless allow for large-scale collection of personal data.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.