In 981–82, relations between the Jarrahids and the Fatimids collapsed and the former were driven out of Palestine. They sacked a Hajj pilgrim caravan later in 982, then annihilated a Fatimid army at Ayla, before being defeated and forced to flee north toward Homs. Between then and Mufarrij's death in 1013, the Tayy switched allegiance between the various regional powers, including the Fatimids, Byzantines, and the Hamdanids' Turkish governor of Homs, Bakjur. By the time of Mufarrij's death, the Jarrahids had restored their dominant position in Palestine. Mufarrij's son, Hassan, maintained relations with the Fatimids under Caliph al-Hakim, but when the latter disappeared, Hassan's relations with his successor deteriorated.