An Iranian refugee has failed in a bid to sue the federal government for mental health injuries caused by five years of immigration detention.

Payam Saadat was held in immigration detention in Western Australia and then South Australia after arriving on Ashmore Reef in 2000.

Mr Saadat fled Iran where he had been detained, tortured and physically abused before seeking asylum in Australia.

His lawyer previously told a trial that the government knew, or should have known, that he was suffering from or vulnerable to a psychiatric illness either caused or made worse by his immigration detention.