A state appeals court today ordered the New York City Police Department to release information on the health risks of the unmarked X-ray vans that it uses to covertly detect explosives.

But the panel overturned a lower court’s ruling that required the department to disclose records on when and where the vans had been used, its policies on van usage, or how much the vans cost, agreeing with the NYPD that concerns over terrorism outweighed the public interest.

For the past four years, ProPublica has sought information about the secretive NYPD counterterrorism program that uses the vans equipped with X-ray machines. The vans can drive alongside vehicles or buildings to find organic materials such as drugs and explosives that may be hidden inside.

But because the vans use backscatter X-rays, which bounce back from the target to create an image, they may also expose unknowing drivers, passengers and pedestrians to ionizing radiation, which can increase the risk of cancer. The X-ray vans are similar to the airport body scanners that were removed by the U.S. Transportation Security Administration over privacy concerns in 2013.

The NYPD has refused to release any records about how it uses the vans and what it does to protect people who may be in the vicinity. Until ProPublica’s lawsuit, the police department had never said anything publicly about them other than to confirm their existence.

In 2015, state Supreme Court Judge Doris Ling-Cohan said the NYPD’s argument amounted to “mere speculation” and was “patently insufficient” to outweigh the public’s right to know. But in its decision today, the appeals court largely agreed with the NYPD’s argument that releasing the information would “hamper NYPD’s counterterrorism operations and increase the likelihood of another terrorist attack.”

Police reports about past uses of the vans, the NYPD said, would allow terrorists to infer the locations and times when they are not used and plot attacks accordingly. The department also argued that disclosing the total cost to taxpayers would reveal how many vans it had because the vehicles have been reported to cost between $729,000 and $825,000 each.

The appeals court, however, said the NYPD had failed to explain how health and safety information, such as the potential radiation dose to passersby, could be exploited by terrorists — especially since such information has already been made public by the manufacturer and the federal government.

It also reversed the lower court’s order that NYPD pay ProPublica’s attorneys fees and litigation costs, saying an award wasn’t justified.

“We are pleased the court agreed that the police department acted appropriately in withholding information that, if disclosed, would compromise public safety and counterterrorism efforts,” the city’s law department said in a statement.

ProPublica was represented in the case by Yale Law School’s Media Freedom and Information Access Clinic and David Schulz of Levin, Sullivan, Koch & Schulz.

“We are disappointed that the Appellate Division took as specific the entirely conclusory affidavit submitted by the NYPD concerning the risk of terrorism from, for instance, possible disclosure of the aggregate cost of these vans to taxpayers,” ProPublica’s president Richard Tofel said.

“On the other hand,” he added, “we’re gratified that the court ordered disclosure of any reports on the health and safety risks from the NYPD’s deployment of these vans around our city, and we look forward to the prompt disclosure of such documents.”

More than 20 media outlets and nonprofits, including the New York Times, Bloomberg, Buzzfeed, AOL-Huffington Post and the New York Civil Liberties Union, filed briefs in support of releasing the records.