ALEXANDRIA, Va. (CN) – On remand from the Fourth Circuit, a federal judge heard arguments Thursday in a challenge to the National Security Agency’s “upstream” surveillance of international and domestic text-based communications.

Upstream surveillance, which the government argues is allowed under section 702 of the Foreign Intelligence Surveillance Act, involves the NSA tapping into the physical backbone of the internet in the U.S. – the vast network of cables, switches and routers that digitally facilitate communication – to monitor Americans’ international communications, including emails and search terms, with an eye on catching terrorists and spies.

The National Security Agency campus in Fort Meade, Md. (AP Photo/Patrick Semansky)

Former NSA contractor Edward Snowden leaked documents exposing numerous surveillance programs, including upstream, in 2013.

The Wikimedia Foundation, the nonprofit behind Wikipedia and 11 other free-knowledge projects, challenged the practice in a 2015 lawsuit against the NSA, the Office of the Director of National Intelligence, the Department of Justice, and the heads of those agencies.

Upstream surveillance allows the NSA to sift through American’ communications “for tens of thousands of search terms without any basis for suspicion,” according to the complaint.

Represented by the American Civil Liberties Union, Wikimedia argues this practice violates the First and Fourth Amendments and far exceeds the scope intended by Congress.

Senior U.S. District Judge T. S. Ellis III, a Ronald Reagan appointee, dismissed the case in 2015, agreeing with the government’s contention that Wikimedia lacked standing because its allegations about the data collection were speculative in nature.

Wikimedia was originally joined in the lawsuit by Human Rights Watch, Amnesty International and others. On appeal, the Fourth Circuit affirmed that those plaintiffs lacked standing to sue over the upstream surveillance.

However, the Richmond, Virginia-based appeals court vacated the dismissal of Wikimedia because of the specificity of its claims regarding how the NSA is intercepting information on the internet. The three-judge panel remanded the case back to Judge Ellis in Alexandria.

Olivia Scott, a Justice Department attorney representing the NSA, said at Thursday’s hearing that part of determining whether Wikimedia has standing to bring its claims depends on a multitude of factors, including the state secrets privilege doctrine.

The doctrine would prevent Wikimedia from proving it had been spied on due to the amount of information allowed to be shared by the NSA about its surveillance tactics, she said.

“Without clear evidence showing this, it’s like a three out of four-legged stool. This case must be dismissed,” Scott said. “We think the court should dismiss on that basis.”

Patrick Toomey, an ACLU attorney representing Wikimedia, said it is apparent from previous testimony the NSA is spying on Wikimedia’s information because of the massive amount of data Wikimedia’s affiliates communicate worldwide. Since the organization sends information all over the world, its information was not secure under the NSA’s own definition of its monitoring under the Foreign Intelligence Surveillance Act.

Arguing for an injunction blocking the upstream surveillance, Toomey said the ability of Congress to review state secrets could allow a judge to also see privileged information to rule on the case.

Judge Ellis said one of the only ways to find out if Wikimedia had been spied on would be to consider the full scope of its practices.

“I think the case involves a substantial challenge on both sides and I want to consider carefully the arguments you’ve made today,” Ellis said.