An undated aerial photo shows the National Security Agency headquarters building in Fort Meade, Maryland. (Reuters)

For months, the debate around the future of the National Security Agency’s collection of millions of Americans’ phone records was framed as a stark choice between ending the program completely or continuing it exactly as is.

Thursday’s landmark ruling by a federal appeals court in New York — which found that the once-secret program was unlawful — has made the latter option, already a long shot, even more remote, political observers said.

As Congress races to meet a June 1 deadline to decide the program’s fate, lawmakers, lobbyists and legal experts are mulling the impact of the decision by the U.S. Court of Appeals for the 2nd Circuit. And many say that the argument for extending the program through what is known as a “clean reauthorization” of the law just became less compelling.

“A clean reauth was already a non-starter,” said one Senate aide on the condition of anonymity because the aide was not authorized to speak on the record. “This puts the nail in the coffin.”

Section 215 of the USA Patriot Act expires in a few weeks, and a failure by Congress to act would mean the program — which the appeals court said violates the law — would end.

Intelligence officials say the program is vital to help the NSA find leads to terrorist suspects who might be plotting an attack against the United States.

The program was revealed by former NSA contractor Edward Snowden, who Friday called the ruling “extraordinarily encouraging” in a live-streamed interview at the Nordic Media Festival.

At issue is the collection of records of the times, lengths and dates of calls, but not their content. On Thursday, the court said the collection of “staggering” amounts of call records amounted to “sweeping surveillance” that represented “an unprecedented contraction of the privacy expectations of all Americans.”

A number of lawmakers who want to end the NSA program hope to do so by modifying Section 215 to enable the government to seek from phone companies only the records of calls made by suspected terrorists and of callers in touch with those people.

Supporters of this approach, contained in bipartisan legislation called the USA Freedom Act, say the ruling gave them a boost. They are resisting efforts by Senate Majority Leader Mitch McConnell (R-Ky.) to pass a clean reauthorization of the law.

“It would be the height of irresponsibility to extend these illegal spying powers when we could pass bipartisan reform into law instead,” Senate Minority Leader Harry Reid (D-Nev.) said Thursday. “I . . . will use the tools at my disposal to stop any attempt to extend these powers for any length of time without reforming them.”

The White House is expected to endorse the USA Freedom Act shortly before it comes to the House floor for a vote scheduled for next Wednesday. The House is expected to pass the bill — some say by a large margin. That would increase the pressure on the Senate to take up the legislation, aides said.

The ruling also has given more ammunition to those who support simply letting Section 215 expire. That would end the NSA’s bulk collection of phone records but would also eliminate an authority used by the government to obtain more limited sets of financial, educational and other records in national security investigations. It would also remove powers used to track “lone wolf” suspects who are not connected to any terrorist group and to put “roving” wiretaps on suspects who frequently switch communications devices.

The intelligence community is opposed to losing each of those authorities.

“Section 215 is critical to a wide range of counterterrorism investigations that have nothing to do with NSA’s [phone records] program,” said Stewart Baker, a former NSA general counsel and a partner at Steptoe & Johnson. “Allowing it to expire entirely because of a disagreement over the NSA program would be a disaster — the most feckless and irresponsible choice that Congress could make.”

But a number of privacy and transparency advocates from the left and right support letting the section expire. A second Senate aide gives this option “not an insignificant chance,” given that Congress has two weeks to act before it is scheduled to go into recess, and next week it is expected to take up a trade bill.

One Republican lobbyist who works on surveillance issues predicted that the Senate will pass the USA Freedom Act. “They’re going to get it done,” said Bruce Mehlman, a partner at Mehlman Castagnetti Rosen Bingel & Thomas. “The question is whether they get it done now or go through a month of yelling at each other and then passing it. The pain is unavoidable. The suffering is optional.”

On Friday, Sen. Dianne Feinstein (D-Calif.), the ranking Democrat on the Senate Intelligence Committee, said there is “strong support among the American people and the Obama administration to restructure the [NSA] program” in a way that requires the government to get approval from the federal surveillance court before seeking specific call records from companies, rather than allowing the NSA to continue collecting them in bulk. She said she is “open” to supporting such reform.