Four asylum seekers have been jailed after a riot that caused $9 million damage at Villawood Immigration Detention Centre in Sydney.

About 100 detainees were involved in the riot in April 2011, in which an office building was set on fire along with furniture and rubbish.

Roof tiles and other objects were thrown at workers at the detention centre, and the compound had to be evacuated.

In the Supreme Court of New South Wales, Justice Robert Hulme handed down sentences ranging from 14 to 22 months to Taleb Feili, Mohammed Amiri, Majid Parhizar and Ali Haidari.

A fifth man was put on a two-year good behaviour bond.

In his judgement, Justice Hulme said he understood that the rioters felt despair and frustration, but that did not excuse their actions.

"Everyone has the right to protest ... but the use of violence is completely unacceptable," he said.

Justice Hulme acknowledged the men had mental health concerns such as depression and anxiety partly due to the time they had spent in detention.

He told the court he gave the men lighter sentences because those conditions lowered their moral culpability.