Mecca with Rajih, the three reconciled and Idris returned to the co-rulership. In 655 or 656 AH (1257 or 1258) Abu Numayy left Mecca to fight the Thaqif tribe, and in his absence some sons of Hasan ibn Qatadah took over Mecca and captured Idris. When Abu Numayy heard the news he returned to Mecca and the attackers fled without fighting, having held the city for six days. In 659 AH (1261) al-Muzaffar Yusuf performed the Hajj. When he neared Mecca with his army Abu Numayy and Idris fled out of fear, returning only after his departure ten days after the completion of the Hajj. In Sha'ban 667 AH (April 1269) Abu Numayy ousted Idris and ordered the khutbah with the name of al-Zahir Baybars, the Mamluk Sultan of Egypt. He informed Baybars that he had deposed his uncle due to the latter's pro-Rasulid inclinations, and requested that the Sultan issue a royal decree forbidding the Emir of Medina from assisting Idris. Baybars accepted Abu Numayy's allegiance on the condition that he fulfill his responsibilities towards the Masjid al-Haram and its visitors, including that he not impose any additional taxes. The Sultan further stipulated that both the khutbah (sermon) and Nuqrah dirhams. After Abu Numayy accepted these conditions Baybars sent him a diploma of investiture. Soon afterwards Idris reconciled with Abu Numayy and Baybars confirmed them both as joint Emirs. That year Baybars performed the Hajj and was pleased with their rule. Independent rule In Rabi al-Awwal 669 AH (November 1270) Abu Numayy's son was killed and he fought with Idris, who ousted him from the Emirate. Abu Numayy fled to Yanbu to seek assistance from its Emir. Forty days later, in Jumada al-Ula (December 1270) he returned with reinforcements and defeated Idris at Khulays. Abu Numayy personally beheaded his uncle and assumed independent control of the Emirate. In late Safar 670 AH (October 1271) Jammaz ibn Shihah, Emir of Medina, entered into an alliance with Ghanim ibn Idris ibn Hasan ibn Qatadah, Emir of Yanbu, and together they captured Mecca and deposed Abu Numayy. They held the city for forty days, until Rabi al-Akhir (November 1271), when Abu Numayy defeated them in battle and retook the city. On 19 Rabi al-Akhir 675 AH () Jammaz advanced on Mecca with Idris ibn Hasan ibn Qatadah, Emir of Yanbu, and an army of 215 horsemen and 600 footsoldiers. He was defeated