The man, named only in Friday's proceedings as ZY, is serving a 21-month jail term imposed last December for offences including indecent images of children and blackmail.
According to the man's legal team, medical evidence showed that naming him publicly could trigger a suicide attempt and the level of threat was assessed as being "immense".
Psychiatric reports referred to ZY having zero ambition and suicidal thoughts. He claimed he could see no future and did not want to go on after fearing he would be named.
Ruling on the case, Mr Justice McCloskey acknowledged the "undeniable" rights of the press.
Unmeritorious convicted prisoners will gain nothing from this intensely fact-sensitive decision.
Mr Justice McCloskey
But the judge found that the medical evidence demonstrated that publicity could lead to suicide, with the risk both real and immediate.
"The right to life is absolute. It has consistently been described as sacrosanct, fundamental, supreme and inviolable," he said.
"It's difficult to conceive of any case where the right to freedom of expression would trump the right to life."
Imposing a final and permanent ban on both the press and the Courts Service disclosing any of ZY's details, he rejected claims that the order could open the floodgates to similar legal action.
The case and subsequent ruling are understood to be legal firsts.