WASHINGTON — In May, reacting to revelations of the National Security Agency’s mass collection of Americans’ phone records, members of the House of Representatives voted by a wide margin to end the program.

On Tuesday night, their counterparts across the U.S. Capitol could not win enough votes to proceed even with debate on a bill that sought to accomplish much the same thing.

Part of what accounts for the different outcome is a shift in the climate over the past six months, as a steady stream of disclosures about government surveillance has abated. At the same time, Republican opponents of an overhaul of the NSA’s programs have been bolstered by a renewed fear of terrorist attacks by the Islamic State militant group — and a sense that now is not the time to alter the intelligence community’s authorities.

Indeed, GOP advocates for the NSA and others appealed to those fears in moving to block the Senate debate.

On the eve of the vote, two former top national security officials campaigned against the bill in a Wall Street Journal op-ed headlined “NSA Reform that Only ISIS Could Love.”

Former NSA Director Michael Hayden, who also headed the CIA, and former Attorney General Michael Mukasey warned that ISIS “uses sophisticated Internet communications to swell its ranks with recruits bearing U.S., Canadian or European passports who can easily slip back into their native countries and wreak havoc.”

That op-ed set the tone for Tuesday’s GOP-led assault on the USA Freedom Act, which also specified other surveillance reforms.

“I think it’s a bad bill,” Sen. John Cornyn, R-Texas, said. Citing Hayden and Mukasey’s comments, Cornyn said the measure “takes us back to a pre-9/11 lack of capacity to identify terrorists making telephone calls in the United States. I think that kind of unilateral disarmament would be bad for the country.”

“We need reform at the NSA, but not in this manner,” Sen. Susan Collins, a moderate Maine Republican, said.

More than a year after the first revelations by former NSA contractor Edward Snowden, the “impact may have aged off,” Hayden said in an interview Tuesday. “We’re getting a lot of videos on the evening news of Americans being beheaded. If this [debate] is truly about what is the American people’s comfort level, that may be a moving target.”

Sen. Patrick Leahy, D-Vermont, who chairs the Judiciary Committee and co-sponsored the bill, chastised opponents of the measure, suggesting they were appealing to emotion rather than reason and that they were overplaying the effectiveness of the NSA program in foiling terrorist plots.

“It did nothing to stop [the Islamic State] from starting in the first place,” he said.

“This nation should not allow our liberties to be set aside by passing fears,” Leahy said.

Supporters of reform said the June 1 expiration of a provision the government uses to authorize the collection will force lawmakers to choose: Are they for keeping the program or ending it?

“As we approach the June sunset date, the leverage we reformers have is going to go up dramatically,” said Rep. Adam Schiff, D-California, who serves on the House Intelligence Committee.

He predicted opponents of reform will play “hardball” as long as they think they can win reauthorization of the law, known as Section 215 of the Patriot Act. “But when they realize the votes aren’t there in the House, they’re going to have to come to the table and make serious concessions.”

Others are more circumspect.

“I don’t think that there are any firm conclusions that can be drawn now,” Laura Murphy, Washington legislative director at the American Civil Liberties Union, said. “We have to wait and see how the dust settles.”

Murphy said it took more than a year to build the coalition supporting the USA Freedom Act. It comprises not only the Obama administration, including the director of national intelligence and attorney general, but also members of both parties, tech companies, privacy groups and the National Rifle Association.

She said shortly after the first Snowden revelation in June 2013, she showed the NRA an FBI training manual that taught agents how to use Section 215 to find gun records. That helped draw the group into the reform camp, she said. “I think the coalition effort was hurt by Republican leadership demands,” she said, “but I don’t think it’s beyond repair.”

The task of revamping any legislation will fall to Republicans, who will control both houses of Congress next year.

On Monday, Republican opponents of the bill pressed their caucus hard in the hours before the vote.

“A lot of our sales pitch to folks was, ‘Look, you guys are going to be in charge next year. You’re the ones who ought to write this bill,’” Sen. Saxby Chambliss of Georgia, the ranking Republican on the Intelligence Committee, who is retiring this year, said. “It’s a terrible piece of legislation that in my opinion could not be fixed.”

Some lawmakers said President Barack Obama, who called on Congress to end the NSA program, can always end it on his own. “Because the DNI and the administration are supportive of this, there’s no reason not to go forward [and end it] whether we require it or not,” Schiff said, adding that most of the technical work can be done without legislation.

The courts are also confronting the issue. Several court challenges are pending to the constitutionality and legality of the bulk collection program.

Washington Post researcher Julie Tate contributed to this report.