(Bloomberg) -- The US can stop Twitter Inc. from releasing details about the government’s demands for user information in national security investigations, a court ruled, in the same week House Republicans are to grill national security officials over surveillance.

Twitter had protested the government’s redactions to a 2014 “transparency report” that featured a numerical breakdown of national security-related data requests from the previous year. The US appeals court in San Francisco on Monday agreed with a lower-court judge that the Justice Department had shown a “compelling” interest in keeping that information secret.

Based on classified and unclassified declarations provided by government officials, the court was “able to appreciate why Twitter’s proposed disclosure would risk making our foreign adversaries aware of what is being surveilled and what is not being surveilled — if anything at all,” US Circuit Judge Daniel Bress wrote for the three-judge panel.

Read More: Twitter’s Surveillance Data Challenge Ignores Security, DOJ Says 

A lawyer for Twitter referred a request for comment on the decision to the company; a company spokesperson didn’t respond. A Justice Department spokesperson declined to comment.

Bruising Fight

Although the case is almost a decade old, the ruling comes just as lawmakers and US national security agencies gear up for a bruising fight over making changes to a key surveillance program.

Read More: GOP’s Jim Jordan Zeros In on Garland With Demand for DOJ Files

Section 702 of the Foreign Intelligence Surveillance Act, described by intelligence officials as a key authority, expires on Dec. 31 unless Congress votes to renew it. US agencies use the authority to compel internet and technology companies to turn over information about suspected foreign terrorists and spies. 

Changes to Section 702 could include altering what companies like Twitter are required to do in response to government demands.

Former President Donald Trump, who is running for a second term in 2024, and conservative lawmakers have criticized the government’s use of FISA and other spy authorities and vowed to curb government powers affecting companies like Twitter. Conservatives have also seized on “the Twitter Files,” information released by Twitter’s new owner, Elon Musk, about how the platform decided to handle certain politically freighted news. 

‘Weaponization’ of Government

The House Intelligence Committee plans to question national security officials on US spy programs during a hearing Thursday on global threats. Also on Thursday, a House Judiciary subcommittee on the “weaponization” of the federal government is to hold a hearing on the Twitter Files.

Read More: Communications Firms Lose Latest FBI User Surveillance Skirmish

The case at issue in Monday’s decision involved efforts by Twitter to share information about two types of federal law enforcement demands on the social media company: “national security letters” for subscriber information, which would cover metadata but not the substance of any electronic communications, and orders under FISA, which could include content.

“The government may not fend off every First Amendment challenge by invoking national security,” Bress wrote. “But we must apply the First Amendment with due regard for the government’s compelling interest in securing the safety of our country and its people.”

Bress was joined in the opinion by fellow Trump nominee Judge Lawrence VanDyke and Judge Carlos Bea, appointed by former President George W. Bush.

The case is Twitter v. Garland, 20-16174, 9th US Circuit Court of Appeals (San Francisco).

(Adds Justice Department’s declining to comment in fourth paragraph.)

©2023 Bloomberg L.P.