In a footnote to her decision, Rogers said she didn't believe that provisions in FISA prohibiting disclosure of individual warrants mean that recipients of those orders can't disclose a tally of how many they receive.

"The Court has never found the Government’s logic persuasive on this point. The requirement not to disclose a particular order is completely distinct from disclosing the aggregate number of orders," Rogers wrote.

The judge, an appointee of President Barack Obama, also questioned whether the executive order governing the classification system has sufficient procedural safeguards to satisfy the First Amendment. However, she said Twitter didn't raise that issue directly in its suit, so she reached no definitive conclusion on that point.

Despite her misgivings about some of the government's legal positions, Rogers said she accepted the claims of three current or former FBI officials — Michael Steinbach, Michael McGarrity and Jay Tabb — that disclosure of the data Twitter wanted to release would cause "grave or imminent harm" to U.S. national security.

Many of the arguments from those men were submitted to the court under seal, so the public did not get to see them. Twitter asked that one of its lawyers who has a security clearance be allowed to view the material, but Attorney General William Barr stepped in last year to assert the state secrets privilege to block disclosure to the attorney, Lee Rubin.

A spokesman for Twitter said in a statement that the firm regretted the ruling tossing out the suit. It was filed in 2014 as the tech industry responded to blockbuster disclosures by former National Security Agency contractor Edward Snowden about far-reaching surveillance practices by U.S. spy agencies.

"We believe it is vital that the public see the demands we receive, and how we work to strike a balance between respecting local law, supporting people's ability to Tweet, and protecting people from harm," the statement said. "While we are disappointed with the Court's decision, we will continue to fight for transparency."

One expert on classified information policy said the judge's comments were startling because they question the bedrock of the U.S. classification framework: the presidential executive order that controls information classified at the confidential, secret and top secret levels. Rogers suggested it may lack a judicial oversight mechanism as well as explicit time limits on how long information can be restricted.

"The court is suggesting that the national security classification system itself may not be constitutional since it does not clearly satisfy the requirements of the U.S. Supreme Court's 1965 ruling in Freedman," a case involving film censorship boards, said Steven Aftergood of the Federation of American Scientists. "That's a breathtaking assertion. But it also rings true. ... Classification policy produces expansive and growing restrictions on expression — exactly what Freedman was supposed to preclude."

Aftergood said the issues Rogers raised but didn't resolve are certain to recur.

"Although the question is not resolved here, one can say with confidence that it will come up again in future litigation," he said.