A federal judge scolded the government on Wednesday for being overprotective of potentially disturbing images of how the military treated prisoners in Iraq and Afghanistan and proceeding as if court review of its decisions about the pictures should not exist.

U.S. District Judge Alvin Hellerstein said in a written decision that the government had not explained the criteria it considered in determining that the release of an undetermined number of pictures he had already ordered released would threaten Americans overseas.

The government has said release of the photographs showing abuse of detainees in Iraq and Afghanistan could provoke attacks against U.S. military forces or incite anti-U.S. sentiment across the region. It released 198 pictures last year, but hundreds or thousands more are believed to exist.

The judge said the government fell far short of defending its claims, including by failing to explain why the photographs would produce such results. He chastised the government for arguing that judicial review of national security judgments is disallowed.

"But that is not the law," he said.

The judge noted U.S. involvement in the region has changed dramatically in the 12 years of his rulings regarding an American Civil Liberties Union lawsuit brought under the Freedom of Information Act to force release of the pictures.

He said the government should consider that U.S. troop presence in Iraq has declined from more than 100,000 troops in 2009 to approximately 5,000 today and it should determine whether the many photographs of abuse already released have caused violence. International outrage resulted after some images of abuse at the Abu Ghraib prison in Iraq appeared publicly in 2004 and 2006.

"To give in to fear of our enemies, their propaganda, or their blackmail, is to surrender some of our dearest held values," he wrote.

He cited the Islamic State group's presence in parts of Iraq and said the group's "pernicious campaign of public beheadings, enslavement, and indiscriminate killings of people it considers apostates are indisputable proof that its members ... 'do not need pretexts for their barbarism.'"

A spokesman for government lawyers declined to comment.

The director of the ACLU National Security Project, Hina Shamsi, called the decision "a victory for government transparency on national security issues."

"All of the pictures must be released to help ensure the full story of American torture is truly known," Shamsi said. "This is important now more than ever in light of recent calls by some to return to torture."

In 2009, Congress passed a law letting the government keep the photos secret if the secretary of defense certified that unveiling them would endanger U.S. citizens or government or military personnel.

Defense secretaries have since done so, but the judge said the government must provide enough information to make judicial review possible.

He said the latest government claim was "vague and unlimited as to who is endangered." He said the Department of Defense secretary's methodologies and criteria must be disclosed.