Scott Morrison claims lives could be placed at risk if the case against a former spy is made public.
The ex-military intelligence officer, given the pseudonym Alan Johns, was tried and jailed in secret under national security laws.
The unusual case only came to light after he launched a court challenge against the prison for tipping off police about a memoir he was writing.
There were secret federal government orders in place banning sharing of information on the man's identity, with police asking guards to warn them of any risk of those orders being breached.
"There are court orders in place restricting disclosure of information on that matter," the prime minister said on Thursday.
"The attorney-general has said the information is of the kind that could endanger the lives and safety of others."
Mr Morrison pointed to the national security laws as to why details on the case were kept under wraps.
The man, also known as Witness J, graduated from the Royal Military College at Duntroon.
He served in East Timor, Iraq and Afghanistan before being thrown behind bars, the ABC reports.
ACT Justice Minister Shane Rattenbury only found out about the case through the media, despite having responsibility for Canberra's prison system.
Labor senator Katy Gallagher, the former ACT chief minister, is concerned about the secrecy surrounding the case.
"If I had a prisoner being sentenced under those circumstances, as chief minister, I would have wanted to know about it," Senator Gallagher said.
The former spy, who has since been released, had his cell raided in February after police found out he had written a memoir.
Penning the memoir was a psychiatrist's idea to help with his mental health.
Australian Federal Police officers raided his brother's home the same month, while authorities also restricted the man's access to emails.
He launched legal action to have his email access restored and asked the court to rule on whether prison authorities should have tipped off police about the memoir.
The applications were ultimately denied.
Australian Associated Press