The surveillance state is real and very much alive, but is it legal? The answer may surprise you. Despite constitutional protections against unlawful search and seizure, the Supreme Court and Congress have given the other branch of American government extraordinary power.

As classified documents recently published by The Guardian and The Washington Post reveal, the FBI and the National Security Agency are collecting the phone activity logs (the so-called metadata, encompassing billions of calls per day) of all telephone users in the country. The revelations also confirm that the feds are collecting, screening and reading at least some of the emails and other electronic communications made by suspected terrorists abroad, some of which might “incidentally” include communications made or received by Americans at home, to quote from the declassification memo released Saturday by James Clapper, the director of national intelligence, describing the NSA’s PRISM computer system used to acquire such information.

Surely, you might think, such all-encompassing surveillance must be unconstitutional, and ultimately will be stopped or modified by the Supreme Court.

Think again. President Obama, among many others, has assured us that the government’s spying operations are entirely legal.

The problem is not that the president has taken leave of his senses, or suddenly taken the rest of us for fools. The problem is that he may well be correct, at least according to the way the Supreme Court has thus far interpreted the Constitution.

Because of their classified status, and notwithstanding the recent press revelations, the NSA surveillance operations’ extent and exact methodology remain largely unknown. But from a civil liberties standpoint, what we do know isn’t very encouraging.

Phone Records

Operating under various code names, such as Trailblazer, Stellar Wind and Ragtime, authority for the collection of telephone metadata — the phone numbers each of us calls and the numbers of those who call us — derives from Sections 215 and 505 of the Patriot Act, which was initially passed in 2001 and amended key provisions of the Foreign Intelligence Surveillance Act.

Section 215 (codified at 18 United States Code 1861) authorizes the FBI on behalf of the NSA to apply for court orders requiring phone companies to produce business records “to protect against international terrorism or clandestine intelligence activities.” The section served as the legal basis for the order published by The Guardian that was issued in April by the Foreign Intelligence Surveillance Court to Verizon Business Services.

The court deliberates in secret, issues its orders on an “ex parte” basis without hearing from those affected by them, and only rarely publishes its decisions, although the Justice Department reports annually to Congress on the overall volume of surveillance applications. In 2012, the FBI submitted 1,789 applications to the Foreign Intelligence Surveillance Court. One was withdrawn; all the others were approved.

Section 505 (codified at 18 USC 2709) authorizes the FBI to issue national security letters, without any judicial oversight, to obtain subscriber information and toll billing records from telecom carriers. Recipients of national security letters are subject to gag orders that forbid them from ever revealing the letters’ existence. In 2011, the FBI issued 16,511 such letters.

Those seeking to declare these sections unconstitutional face at least one enormous obstacle: the 1979 case of Smith v. Maryland, in which the Supreme Court held that telephone users have no reasonable expectation of privacy in the records of their calling activities. As the Smith ruling instructs, absent a privacy expectation, no illegal search within the meaning of the Fourth Amendment occurs. Unless the Supreme Court overrules or distinguishes Smith from the NSA’s current spying platforms, legal challenges to orders like the one issued to Verizon are likely to meet with little success.

Internet Content Surveillance

The obstacles facing those seeking to halt or limit the collection and reading of emails and other electronic communications under the PRISM program are in some ways even more daunting, courtesy of the Supreme Court’s decision in Clapper v. Amnesty International, released in February. In a 5-4 majority opinion written by Justice Samuel Alito, the court dismissed a complaint brought by Amnesty International and other human rights groups, reasoning that none of the organizations had suffered actual legal harm, and thus lacked “standing” to sue. None could show, the majority argued, that its communications in fact had been intercepted in the past or that they would likely be intercepted in the future.

Although domestic wiretapping warrants issued by judges must be supported by probable cause, the collection of emails challenged in the Clapper case and involved in the PRISM program is governed by another set of legal provisions, found in Section 702 of the Foreign Intelligence Surveillance Act (codified at 18 USC 1881). These permit the attorney general and the director of national intelligence to obtain Foreign Intelligence Surveillance Court approval of surveillance operations against foreign targets upon certifications of reasonableness that fall short of the warrant requirement for probable cause. The provisions also authorize such operations to proceed without any court approval for up to seven days in “exigent circumstances,” as determined by the attorney general.

Although the PRISM operation on its face is directed solely at foreign targets, even the sleuths at the NSA can’t always determine where a person is located. As a result, the agency reportedly collects information on targets believed with only 51 percent certainty to be outside the U.S.

American journalists and others who investigate national security issues are thus left in a Kafkaesque dilemma, validly concerned that their emails to and from people abroad are being swept up in secret government data dragnets yet foreclosed on technical standing grounds from challenging the dragnets because they are unable to penetrate the very secrecy they object to.

In the absence of a highly improbable constitutional turnaround by the Roberts court or some equally improbable decisive reform of the Patriot Act and FISA by Congress, this is the legal structure we will have for the foreseeable future.

All nations have the right to protect themselves against terror. But in a country that prides itself on the values of transparency and the rule of law, we can do better than the current system, which seemingly falls short in both respects.