In the summer of 865, with the civil war still ongoing, al-Musta'in dispatched Muzahim to secure al-Kufah, which had fallen to an 'Alid rebel. Muzahim defeated the rebels and forced the 'Alid to flee; he also ordered his troops to set fire to al-Kufah after encountering resistance within the city.[5] After reporting news of his conquest, Muzahim received a letter from al-Mu'tazz, urging him to defect from al-Musta'in's side. After discussing the proposal, Muzahim and a number of his soldiers agreed to switch allegiances, and made their way to Samarra.[6]