JAKARTA (REUTERS) - Afif was an inmate in a high-security Indonesian jail when he transformed from aspiring radical to soldier for ISIS (Islamic State in Iraq and Syria), 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 ISIS' brand of violence to Southeast Asia for the first time.
Afif's graduation from jailbird to extremist 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.
Security officials say Afif, also known as Sunakim, was sentenced to seven years in prison for taking part in a militant training camp in the province of Aceh, where Islam is generally practised in a stricter form than other parts of Indonesia.
Once behind bars, he refused to follow deradicalisation programmes, the officials added.
Akbar Hadi, spokesman for the Ministry of Law and Human Rights, declined to comment on whether Afif's activities were monitored after he was released last August.
Police said he planned the Jakarta siege with the three other attackers, one of whom was also a former convict. Four civilians died in the attack along with the militants.
A report by the Institute for Policy Analysis of Conflict (IPAC) last year said that 26 prisons across Indonesia housed about 270 "convicted terrorists", but ISIS supporters accounted for only a small minority of them.
National Police Chief Badrodin Haiti told Reuters that at least five jailed militants were believed to have been in communication with the plotters in the lead-up to the attack.
While inside Jakarta's Cipinang prison, Afif was one of some 20 convicts heavily influenced by fellow convict and firebrand Islamist cleric Aman Abdurrahman, experts said.
From behind bars, Abdurrahman heads an umbrella organisation formed last year through an alliance of splinter groups that support ISIS.
"They shared the same cells, they prayed together, they cooked together," said Taufik Andrie, Jakarta-based executive director of the Institute for International Peacebuilding.
Abdurrahman regularly spread "takfiri" doctrine, a belief among Sunni militants who justify their violence by branding others as infidels, through his sermons and lectures.
Abdurrahman was moved to a maximum security prison in Nusakambangan in Central Java in 2013, but continued to communicate with Afif and a growing group of around 200 followers using couriers and cell phones.
A lawyer for Abu Bakar Ba'asyir, another high-profile radical inmate at Nusakambangan, told Reuters it is easy to convey messages to the outside world from inside prison.
"Any kind of visitor is allowed and even if they don't exchange any cell phones, there is still an exchange of information and the visitor can interpret that," said Achmad Michdan.
Experts say radical inmates like Abdurrahman still get away with disseminating sermons by email, Facebook, and hard copies. Despite being behind bars, Abdurrahman was able to make an online pledge of allegiance to Islamic State in 2014.
"Those with more radical thinking can also hold religious sermons on a regular basis and it is very easy to convey radical ideas to others," said Farihin, a former militant who participated in a government deradicalisation programme during his time in a prison in Palu on the island of Sulawesi.
Indonesia's counter-terrorism chief, Saud Usman Nasution, said in November that prison officials were unable to halt this type of communication because of overcrowding.
"We are aware that there is a problem with convicts being allowed to communicate using the Internet and cell phones. There is definitely room for improvement," said Ministry of Law and Human Rights spokesman Hadi, adding that inmates cannot be forced to join deradicalisation programmes.
Experts say access to social media and messaging apps like Telegram is a large part of the problem.
Police believe the alleged mastermind of the Jakarta attack, an Indonesian fighting with Islamic State in Syria called Bahrun Naim, used social media to communicate his radical ideas to followers in Indonesia.
He may also have transferred thousands of dollars to accounts here, police said.
Since the attack, Indonesia has blocked websites and sent letters to social media networks Twitter, Facebook and Telegram, asking them to take down radical content.