Wawan was accused of having provoked a riot in May at a high-security police detention center in which six officers were killed by Islamic inmates who took control of part of the prison near Indonesia’s capital. One militant was also killed.
A week later, four sword-wielding men who allegedly belonged to Jemaah Anshorut Daulah attacked a police headquarters in Pekanbaru and were fatally shot by police. A fifth man who drove their vehicle was arrested while trying to escape. One officer died and two others were injured.
The Islamic State group claimed responsibility for the attack in a statement carried by its Aamaq news agency.
Prosecutors had sought a 13-year jail sentence for Wawan, but the panel of judges said they decided to be lenient because of his politeness during the trial and because he had never been sentenced in a criminal case before.
Indonesia has carried out a sustained crackdown on militants since bombings by al-Qaida-affiliated radicals in Bali in 2002 killed 202 people.