The White House, Congress and the National Security Agency were bracing for a pivotal and unpredictable vote on Wednesday on the future of domestic mass surveillance in the US.

Debate was due to begin on Wednesday afternoon on an amendment tabled by congressman Justin Amash, a two-term libertarian Republican from Michigan, that would prevent the NSA from collecting bulk phone records on millions of Americans.

The vote on the amendment provides the first test of congressional opinion about the widespread NSA surveillance revealed by the whistleblower Edward Snowden and reported in the Guardian.

"This is the moment," said Michelle Richardson, a surveillance lobbyist for the ACLU.

Even if Amash's push to limit the NSA program fails, civil libertarian groups are preparing for a long battle, fueled by the belief that public opinion is finally tipping their way. On Thursday, a court in New York was due to hear preliminary legal arguments on a case brought by the ACLU that challenges the constitutionality of the NSA's mass collection of phone records.

It is the first court challenge since the Snowden revelations, and the ACLU believes it has a strong case because of the publication by the Guardian of a secret court order authorising the bulk collection of Verizon records, and because it is a Verizon customer.

In Washington on Wednesday, the Obama administration, the intelligence community, and its legislative allies were battling what has become known as the Amash amendment, portraying it as recklessly ending a longstanding, secret surveillance activity they consider vital for national security.

The legislative fight is the rare Washington battle that does not divide along partisan lines, but between civil liberties supporters in both parties and security hawks in both parties. Amash's bill has the support of the longtime liberal Democratic congressman John Conyers of Michigan, the top Democrat on the House judiciary committee.

Late on Tuesday, the White House took the unusual step of vocally opposing the amendment ahead of the vote to include it in the annual Defense Department funding bill, calling it "not the product of an informed, open, or deliberative process" and warning it would "hastily dismantle" a counterterrorism tool.

The statement, by White House press secretary Jay Carney, said: "We urge the House to reject the Amash amendment and instead move forward with an approach that appropriately takes into account the need for a reasoned review of what tools can best secure the nation."

Tuesday night's statement did not specify what that alternative might be; nor did the Obama administration ever publicly discuss or debate the extent of the bulk domestic phone records collection it maintained from the Bush administration before the Guardian revealed it last month.

"When's the last time a president put out an emergency statement against an amendment?" Amash tweeted late Tuesday night. "The Washington elites fear liberty. They fear you."

The senior members of the House intelligence committee, Republican chairman Mike Rogers and ranking Democratic Dutch Ruppersberger, urged their colleagues on Tuesday to reject the amendment. They pledged to "develop appropriate additional protections" for Americans' privacy over their phone records, but it was unclear on Wednesday what those would be.

The committee efforts came on the heels of a marathon lobbying session from General Keith Alexander, the NSA director, who spent four hours on Tuesday in two separate classified briefings – one for Republicans, the other for Democrats – to defend the bulk phone records programme, which NSA justifies under Section 215 of the Patriot Act.

"Just how important this vote is was underlined when they started doing the classified briefings and the intelligence community came out in full force and acknowledged this amendment would stop their bulk collection under 215," the ACLU's Richardson said.

Richardson said the legislative scrambling ahead of the Amash amendment was so intense that the outcome of the vote "can't be predicted right now."

A Washington Post poll released on the eve of the debate over the Amash amendment found widespread public skepticism of the NSA. Seventy-four percent of respondents said that the agency's monitoring of telephone records and internet communications intrudes on Americans' privacy rights generally, with 49% believing it intrudes on their own.

Two of the most respected Washington personages on national security issues, Thomas Kean and Lee Hamilton, the Republican and Democratic chairmen of the 9/11 commission, wrote that the bulk surveillance poses "serious questions for our country."

"The NSA's metadata program was put into place with virtually no public debate, a worrisome precedent made worse by erecting unnecessary barriers to public understanding via denials and misleading statements from senior administration officials," Kean and Hamilton wrote on Politico shortly before the vote on the Amash amendment. Hamilton, a former Indiana congressman, was one of Obama's earliest foreign policy advisers when the president served in the Senate.

"Whether the amendment succeeds or fails, the support and attention it has garnered sends a clear message to the intelligence community," said Elizabeth Goitein of the Brennan Center for Justice at New York University Law School.

"Members of both parties are picking up on the sentiment of the American people that there are limits to what the government should be permitted to do in the name of national security. We all want to be kept safe from terrorism, but that is not a license to engage in indiscriminate collection of Americans' personal information."

Shortly before debate began on his amendment, Amash tweeted: "Today, Members of Congress will have to answer a simple Q: Do you oppose blanket, suspicionless collection of all Americans' phone records?"