A divided Supreme Court halted a legal challenge Tuesday to a once-secret warrantless surveillance project that gobbles up Americans' electronic communications, a program that Congress eventually legalized in 2008 and again in 2012.

The 5-4 decision (.pdf) by Justice Samuel Alito was a clear victory for the President Barack Obama administration, which like its predecessor, argued that government wiretapping laws cannot be challenged in court. What's more, the outcome marks the first time the Supreme Court decided any case touching on the eavesdropping program that was secretly employed in the wake of 9/11 by the President George W. Bush administration, and eventually codified into law twice by Congress.

A high court majority concluded that, because the eavesdropping is done secretly, the American Civil Liberties Union, journalists and human-rights groups that sued to nullify the law have no legal standing to sue – because they have no evidence they are being targeted by the FISA Amendments Act. Some of the plaintiffs, which the court labeled "respondents," are also journalists and among other things claimed the 2008 legislation has chilled their speech and violated their Fourth Amendment privacy rights.

The act, known as §1881, authorizes the government to electronically eavesdrop on Americans' phone calls and e-mails without a probable-cause warrant so long as one of the parties to the communication is outside the United States. The communications may be intercepted "to acquire foreign intelligence information."

The FISA Amendments Act generally requires the Foreign Intelligence Surveillance Court to rubber-stamp terror-related electronic surveillance requests. The government does not have to identify the target or facility to be monitored. It can begin surveillance a week before making the request, and the surveillance can continue during the appeals process if, in a rare case, the secret FISA court rejects the surveillance application.

"Yet respondents have no actual knowledge of the Government's §1881a targeting practices. Instead, respondents merely speculate and make assumptions about whether their communications with their foreign contacts will be acquired under §1881a," Alito wrote.

Joining Alito were Chief Justice John Roberts, and Justices Anthony Kennedy, Antonin Scalia and Clarence Thomas.

In dissent, Justice Stephen Breyer said standing should have been granted. He said that the spying, "Indeed it is a s likely to take place as are most future events that commonsense inference and ordinary knowledge of human nature tell us will happen."

Signing the dissent were Justices Ruth Bader Ginsburg, Elena Kagan and Sonia Sotomayor.

The legislation authorizing the spying was signed into law the first time in July 2008 and the ACLU immediately brought suit.

Then-senator and presidential candidate Barack Obama voted for the measure, though he said the bill was flawed and that he would push to amend it if elected. Instead, Obama, as president, simply continued the Bush administration's legal tactics aimed at crushing any judicial scrutiny of the wiretapping program. Obama signed legislation in December that extended the measure's effectiveness for another five years.

The case before the justices was a review of a surprising 2011 appellate court decision that reinstated the ACLU's lawsuit, which the Obama administration asked the Supreme Court to dismiss. A majority of the justices agreed with the government's contentions (.pdf) that the ACLU and a host of other groups don't have the legal standing to bring the case because they have no evidence they or their overseas clients are being targeted.

A lower court, taking the same position as the high court's majority, had ruled the ACLU, Amnesty International, Global Fund for Women, Global Rights, Human Rights Watch, International Criminal Defence Attorneys Association, The Nation magazine, PEN American Center, Service Employees International Union and other plaintiffs did not have standing to bring the case.

The groups appealed to the 2nd U.S. Circuit Court of Appeals, arguing that they often work with overseas dissidents who might be targets of the National Security Agency program. Instead of speaking with those people on the phone or through e-mails, the groups asserted that they have had to make expensive overseas trips in a bid to maintain attorney-client confidentiality.

"They cannot manufacture standing by incurring costs in anticipating of non-imminent harms," Alito wrote.

The appeals court in 2011 agreed with the ACLU, ruling that they had standing because they had ample reason to fear the surveillance program.

But even if the Supreme Court sided with the ACLU on Tuesday, that does not necessarily mean the constitutionality of the FISA Amendments Act would have been litigated. That's because the only issue before the high court was whether the plaintiffs had the legal standing to bring the case. Because they don't, the case is over.

Had the justices gone the other way, the lawsuit would have returned to a New York federal courtroom where, if past is prologue, the Obama administration likely would play its trump card: an assertion of the powerful state secrets privilege that lets the executive branch effectively kill lawsuits by claiming they threaten to expose national security secrets.

The courts largely defer to such claims. But in a rare exception in 2008, a San Francisco federal judge refused to throw out a wiretapping lawsuit against AT&T under the state secrets privilege. The AT&T lawsuit was later killed anyway, because the FISA Amendments Act also granted the phone companies retroactive legal immunity for their alleged participation in the NSA spying program.