Al-Aziz died in October 996 and was succeeded by his under-age son, al-Hakim, whereupon a fierce factional struggle erupted between the Turkish troops, led by Manjutakin, on the one hand, and the Kutama Berbers, who under al-Hasan ibn 'Ammar moved to seize control of the caliphal government.
In 997, Mufarrij tried to capture Ramlah and devastated the surrounding lands, but was attacked by the new governor of Damascus, Jaysh ibn Samsama, and forced to once again flee to the lands of his fellow Tayy in the mountains of northern Hejaz.