(Reuters) - A federal appeals court on Thursday declared unconstitutional Arizona’s policy of letting state prison officials read inmates’ outgoing mail to their lawyers.

Reversing a lower court ruling, the 9th U.S. Circuit Court of Appeals said Arizona’s authorization of a page-by-page review of death row inmate Scott Nordstrom’s legal mail violated his Sixth Amendment right to correspond confidentially with his lawyer, and his First Amendment right to free speech.

The office of Arizona Attorney General Mark Brnovich, which represented the Arizona Department of Corrections, did not immediately respond to requests for comment. A lawyer for Nordstrom did not immediately respond to similar requests.

Nordstrom sued after a prison officer allegedly rebuffed his request to stop reading a letter addressed to his lawyer. The official allegedly said he was authorized to scan the content and told Nordstrom, “Don’t tell me how to do my job.”

Writing for a 3-0 appeals court panel, Circuit Judge Milan Smith said Arizona had a legitimate interest in prison security, and that prison officials could inspect outgoing mail for “suspicious features” such as escape maps or contraband.

But he said it was “unduly intrusive” for officials to read outgoing legal mail addressed to licensed lawyers, because there was no evidence of a threat.

“The ends do not justify the means,” Smith wrote. “Confidential legal correspondence, free from unreasonable censorship and the chilling effect of excessive monitoring, remains an important avenue of communication for inmates.”

The appeals court returned Nordstrom’s case to U.S. District Judge David Campbell in Phoenix “to craft a decree based on the evidence of actual risks in Arizona state prisons.”

The case is Nordstrom v Ryan et al, 9th U.S. Circuit Court of Appeals, No. 16-15277.