A judge criticized new rules governing gag orders for companies that receive data requests in national security cases. (Chip Somodevilla/Getty Images)

A federal judge in a recent ruling criticized new rules regarding how long the government can demand secrecy from companies when it requests data on national security cases.

These demands, called national security letters (NSLs), are administrative subpoenas issued by FBI officials without having to seek judicial approval. They are generally accompanied by orders forbidding the recipients from disclosing the NSL’s existence.

In an opinion made public this week, U.S. District Judge James E. Boasberg for the District of Columbia became the first judge to publicly assess new gag-order rules issued by the attorney general as mandated by the USA Freedom Act of 2015. These require the goverment to revisit gag orders when an investigation ends or on the three-year anniversary of the original subpoena.

But Boasberg said the rules contain “several large loopholes.” And thus, he said, they “give the court some pause” as to whether they comply with the law.

NSLs have been a flash point in the long-running debate over government secrecy and the proper balance between privacy and security. In particular, the gag-order provision has raised constitutional concerns — so much so that last year, Congress mandated periodic reviews of the need for a gag and the lifting of a gag when it is no longer needed to protect national security.

The law also clarified the right of a company to ask the government for judicial review of a secrecy order. In February, a firm, whose name was redacted from the opinion, made such a request.

In his ruling, Boasberg also rejected the open-ended nature of the gag order, which accompanied requests for data on two of the company’s customers. Such “an indefinite bar . . . seems inconsistent with the intent of the law,” he wrote.

He required that officials reconsider the need for the order’s secrecy every three years or until the gag is no longer necessary.

The Justice Department declined to comment.

“Indefinite gag orders are an affront to the First Amendment, and Congress appears to have recognized that in the USA Freedom Act,” said Alex Abdo, a staff lawyer at the American Civil Liberties Union. “It’s surprising, then, that the procedures the government implemented in response still allow for effectively indefinite gag orders. This ruling will hopefully push the government to finally end its practice of imposing unconstitutional indefinite gags.”

An FBI supervisory special agent may issue an NSL as long as he or she certifies that the records sought are “relevant to an authorized investigation to protect against international terrorism or clandestine intelligence activities.” The records may include subscriber information, bank records or Internet protocol addresses, but not the content of emails or phone calls. The bureau may impose a gag if it certifies that disclosure would harm national security or interfere with a criminal, counterterrorism or counterintelligence probe.

In November, the attorney general approved procedures issued by the FBI requiring a review at the close of an investigation and on the three-year anniversary of the NSL’s issuance.

But Boasberg noted what he called loopholes. One, if a gag order is deemed to be justified at the close of an investigation, it could remain in place indefinitely. Two, there are “a large swath” of NSL gag orders that have been in place for more than three years and so may never be reviewed. Finally, he said, for long-running investigations there could be an “extended period of time — indefinite for unsolved cases” — between the three-year anniversary and the probe’s end.

He also said, however, that he was not suggesting a wholesale “revamping of the FBI’s procedure in relation to all 16,000 NSLs that are issued annually.”

Other than the ruling, the case docket remains under seal.