The U.S. Senate blocked a measure to extend spy agencies' bulk collection of Americans' telephone records early on Saturday, leaving the fate of the program uncertain days before its June 1 expiration.

By a vote of 54-45, the Senate failed to reach the 60-vote threshold needed to advance a bill that would have extended for two months provisions of the "USA Patriot Act" that allow the collection of vast amounts of telephone "metadata."

The data collection program, in which the National Security Agency sweeps up vast amounts of Americans' telephone records and business information, was exposed two years ago by former NSA contractor Edward Snowden, who is now a fugitive in Russia.

The vote against the extension came after the Senate narrowly blocked the "USA Freedom Act," a bill that would end the bulk telephone data collection and replace it with a more targeted program.

That vote was 57-42, just short of the 60 needed.

President Barack Obama's administration had pushed hard for the Freedom Act. The House of Representatives backed it by an overwhelming margin, with strong support from Republicans and Democrats, on May 13.

Backers of the bill in the House, including Representative Bob Goodlatte, the chairman of the Judiciary Committee, said the Senate's failure to act risked the expiration of the Patriot Act provisions before the House returns to Washington late on June 1.

"The Senate has failed to make the important reforms necessary, jeopardizing Americans’ civil liberties and our national security," they said in a statement.

Senate Republican Majority Leader Mitch McConnell had proposed short extensions, ending with one lasting only until June 2, to keep the Patriot Act provisions from expiring. But they were blocked by Republican Senator Rand Paul and Democratic Senator Martin Heinrich.

After failing to get an extension, McConnell said the Senate would return to Washington on Sunday, May 31, one day before the scheduled end of its Memorial Day holiday recess, to consider ways to address the expiration of the Patriot Act provisions at 12:01 a.m. EDT on Monday, June 1.

Opponents of the mass surveillance praised the efforts to shut it down. Democratic Senator Ron Wyden called the Senate vote a step toward ending "an illegal and unconstitutional law."

"A decade after intelligence leaders secretly created a program to violate the privacy of millions of law-abiding Americans, we are on the verge of finally shutting it down," he said.

The Patriot Act was passed to boost national security after the Sept. 11, 2001, attacks. Backers of the Freedom Act argued that it maintained national security protections while easing privacy concerns because it would call for more narrowly targeted data collections than those in the Patriot Act.

"What gets lost in this manufactured crisis is the work of the last two years to draft a responsible bill that protects individual privacy and national security," Senator Patrick Leahy, a Democrat and co-author of the Freedom Act, said in a statement. "It is frustrating that with all that we did to build consensus, we are now facing more delay."

Paul, a 2016 Republican presidential candidate and vocal advocate for privacy rights, led more than 10 hours of speeches against the Patriot Act on Wednesday.

(Reporting by Patricia Zengerle; Editing by Mark Potter, Bill Trott and Frances Kerry)