 The first major campaign of the new reign was directed against the Khurramites in Azerbaijan and Arran . The Khurramite revolt had been going on since 816 / 7 , aided by the inaccessible mountains of the province and the absence of large Arab Muslim population centres , except for a few cities in the lowlands . Al @-@ Ma 'mun had left the local Muslims largely to their own devices , although a succession of military commanders tried to subdue the rebellion on their own initiative , and thus gain control of the country 's newly discovered mineral resources , only to be defeated by the Khurramites under the capable leadership of Babak . Immediately after his accession , al @-@ Mu 'tasim sent the <unk> al @-@ <unk> of Baghdad and Samarra , Ishaq ibn Ibrahim ibn Mus 'ab , to deal with an expansion of the Khurramite rebellion from Jibal into Hamadan . Ishaq achieved success swiftly , and by December 833 had suppressed the rebellion , forcing many Khurramites to seek refuge in the Byzantine Empire . It was only in 835 that al @-@ Mu 'tasim took action against Babak when he assigned his trusted and capable lieutenant , Afshin , to command the campaign against him . After three years of cautious and methodical campaigning , Afshin was able to capture Babak at his capital of <unk> on 26 August 837 , extinguishing the rebellion . Babak was brought in triumph to Samarra , where he was executed . 
