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 by Abu Numayy's forces at Marr al-Zahran, though Abu Numayy was outnumbered with only 100 horsemen and 180 footsoldiers. Idris was captured, but Jammaz escaped.
