Afif was an inmate in a high-security Indonesian jail when he transformed from aspiring radical Islamist to soldier for Islamic State, ready to sacrifice his life for a group based thousands of miles away in the Middle East.

His journey ended with his death last week on a busy intersection in central Jakarta, after the gun and suicide bomb attack he launched with three other militants that brought Islamic State's brand of violence to Southeast Asia for the first time.

Afif's graduation from jailbird to jihadi shines a light on a prison system where staff shortages, overcrowding and corruption have allowed extremists to mingle and emerge as determined killers in the name of Islam.