The United Nations has savaged Australia's policy of locking away refugees for years without charge or trial on the basis of secret intelligence assessments.

An international legal panel at the UN has demanded compensation over "serious psychological harm" done to five men incarcerated for five years - only to be suddenly released into the community in recent months after the secret security finding was reversed.

A former Tamil refugee 'Ragav', released in 2015 after more than five years in immigration detention after ASIO revised its assessment issuing him a visas poses a security threat. Credit:Josh Robenstone

The UN finding again throws a spotlight on what the legal panel slammed as Australia's "arbitrary" practice of indefinite detention for any refugee the Australian Security and Intelligence Organisation initially deems a risk to national security.

At its height more than 50 refugees were held for years after 2009 inside Australia's immigration detention network on security grounds.