WASHINGTON (Reuters) - The U.S. Senate on Thursday passed a bill to renew the National Security Agency’s warrantless internet surveillance program for six years with minimal changes, overcoming objections from civil liberties advocates that it undermined the privacy of Americans.

Slideshow ( 16 images )

The legislation, which easily passed the House of Representatives last week, is expected to be signed into law by President Donald Trump by Friday.

Thursday’s 65-34 passage in the Senate was largely a foregone conclusion, after senators earlier this week cleared a 60-vote procedural hurdle, which split party lines and came within one vote of failing.

Passage of the legislation marked a disappointing end to a years-long effort by a coalition of liberal Democrats and libertarian-leaning Republicans to redefine the scope of U.S. intelligence collection following the 2013 disclosures of classified surveillance secrets by former NSA contractor Edward Snowden.

The bill reauthorizes what is known as Section 702 of the Foreign Intelligence Surveillance Act, which gathers information from foreigners overseas but incidentally collects an unknown amount of communications belonging to Americans.

Under Section 702, the NSA is empowered to eavesdrop on vast amounts of digital communications via American companies like Facebook Inc, Verizon Communications Inc and Alphabet Inc’s Google.

But the program also incidentally scoops up Americans’ communications, including when they communicate with a foreign target living overseas. Intelligence analysts can then search those messages without a warrant.

The White House, U.S. intelligence agencies and congressional Republican leaders said the program is indispensable to national security.

Opponents of the program said it allows the NSA and other intelligence agencies to grab data belonging to Americans in a way that represents an affront to the U.S. Constitution.

The bill passed by Congress does add a narrow warrant requirement for cases where the Federal Bureau of Investigation seeks emails related to an existing criminal investigation that has no relevance to national security. Privacy advocates said that essentially gave more protections to criminal suspects than ordinary Americans caught up in the program’s surveillance.