WASHINGTON (Reuters) - The U.S. Senate on Tuesday advanced a bill to renew the National Security Agency’s warrantless internet surveillance program, as a final push by privacy advocates to derail the measure came up one vote short.

FILE PHOTO: A man is silhouetted near logo of the U.S. National Security Agency (NSA) in this photo illustration taken in Sarajevo March 11, 2015. REUTERS/Dado Ruvic/File Photo

The vote 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 in the wake of the 2013 disclosures of classified surveillance secrets by former NSA contractor Edward Snowden.

The legislation just cleared the procedural 60-vote threshold required to limit debate in the Senate and was expected to earn the simple majority required to officially pass through the chamber sometime later this week. The vote, which split party lines and was held open for nearly an hour and a half as opposing sides jockeyed for final votes, was 60-38.

The bill would extend for six years and with minimal changes the NSA program, which gathers information from foreigners overseas but incidentally collects an unknown amount of communications belonging to Americans. It easily passed the House of Representatives last week despite mixed signals posted on Twitter by President Donald Trump, who is expected to sign the measure into law if it reaches his desk.

Shortly before the vote Richard Burr, the Republican chairman of the Senate Intelligence Committee, implored his colleagues to support the bill, saying the NSA program was “the single most important national security tool we have in the United States.”

But a politically diverse array of Democrats and Republicans said the program was in need of more privacy safeguards and, at the very least, was deserving of an open debate process. The vote, set up last week by Republican Senate leader Mitch McConnell, effectively prevented senators from voting on amendments.

The authorization, formally known as Section 702 of the Foreign Intelligence Surveillance Act (FISA), is set to expire on Friday unless the Senate and Trump sign off, although intelligence officials say it could continue to operate until April.

The bill allows the NSA to eavesdrop on vast amounts of digital communications from foreigners living outside the United States 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, and can search those messages without a warrant.

The White House, U.S. intelligence agencies and congressional Republican leaders have said the program is indispensable to national security, vital to protecting U.S. allies and needs little or no revision.

Privacy advocates say 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.

“Without additional meaningful constraints, Congress is allowing the government to use information collected without a warrant against Americans in domestic court proceedings,” Republican Senator Rand Paul and Democratic Senator Ron Wyden, vocal opponents of the legislation, wrote in a letter to Senate colleagues last week.

Other proposals introduced in Congress would have required investigators to obtain a warrant before sifting through emails belonging to Americans.

The measure before the Senate on Tuesday 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 surveillance programs.