A federal appeals court has ruled that certain records from the prosecution of Keonna Thomas, a North Philadelphia woman sentenced to eight years in prison for aiding the Islamic State online, must remain sealed to avoid risks to national security.

A three-judge panel of the U.S. Court of Appeals for the Third Circuit on Friday upheld a ruling by U.S. District Judge Michael Baylson of the Eastern District of Pennsylvania that denied self-described “alternative news source” The Philly Declaration's motion to unseal Thomas' guilty plea document. The court vacated Baylson's order denying The Declaration's request to access a sealed grand jury exhibit, instead sending it back to him to determine whether portions of it can be redacted and released.

The Declaration had argued that the court's sealing of the documents infringed upon the publication's First Amendment rights.

Third Circuit Judge Joseph Greenaway wrote in the court's opinion that plea hearings and documents are generally open to the press—but there are exceptions to the rule. One of the exceptions is that very individualized or specific records can sometimes be kept hidden.

“The district court determined that the government's law enforcement activities, which involved national security issues and hinged on their non-public nature, and the safety of certain individuals constituted compelling interests that would be substantially harmed by unsealing. These findings are 'specific enough [to allow us to] determine whether the [sealing] order was properly entered,'” Greenaway said.

Michael Berry of Ballard Spahr represents The Declaration in the case and did not immediately return a call seeking comment. The U.S. Attorney's Office in Philadelphia also did not respond to a request for comment.

As for the exhibit, the government suggested releasing a “lightly redacted” version. The Declaration pushed for the fully unsealed document, which was filed as an attachment to Thomas' reply brief to a motion.

Greenaway said the matter had to be sent back to Baylson for further review.

“The issue to be resolved now is to what extent the exhibit should be redacted, if at all. Given the factual—as opposed to purely legal—nature of the inquiry presented, we deem it more appropriate for the district court to initially determine whether the proposed targeted redactions are justified and narrowly tailored in a manner that does not impinge upon the public's right of access. Accordingly, the district court's order as to the reply brief and exhibit will be vacated and the case remanded for consideration of the proposed redactions to the exhibit,” Greenaway said.