A federal judge in New York told the Defense Department yesterday that it would have to release perhaps dozens of photographs taken by an American soldier of Iraqi detainees in the Abu Ghraib prison in Iraq .