An Afghan refugee is in critical condition after he set himself on fire due to child pornography convictions which led to cancellation of his permanent visa.

The man identified as Ali Jaffari was held at a West Australian immigration detention centre when he set himself on fire, Australia’s Special Broadcasting Service (SBS) reported.

He is currently undergoing treatment at Fiona Stanley Hospital in Perth with the officials saying Jaffari has suffered burns to 90 per cent of his body.

Refugee Action Coalition spokesman Ian Rintoul told AAP the visa of Jaffari was cancelled in May last year and he has previously attempted to end his own life.

Rintoul further added that Jaffari had been held at the detention centre, 90km east of Perth, for about eight months.

Jaffari was charged with viewing child pornography on his laptop using free wi-fi for up to three hours a day at a Melbourne public library.

The court had also sentenced him to 300 hours of community service besides his visa was cancelled and laced on the sex offenders register for 15 years over an incident involving a teenage boy in Geelong in November 2012.