لما هلك أبو زكرياء بايع الملأ ابنه محمدا ولقبوه بالمستنصر ودعوه بالأمير واشتهر بالفضل والاعتدال وحسن السيرة والعلم وحميد الخصال وطار صيته في الآفاق وكان العلم في أيامه بحرا زاخرا وقمرا باهرا وعلت دولته ومدت إليه ثغور القاصية يد الاعتصام واجتمع بحضرته من أفاضل أعلام العلماء الوافدين عليه وعلى أبيه وخصوصا الأندلس من شاعر مفلق وكاتب بليغ وعالم نحرير وملك أورع متفيئين ظل مملكته لائذين به منهم حازم ومدحه بمقصورته المشهورة وأبو الحسن بن سعيد وابن الأبار وأضرابهم وأبو محمد عبد الحق بن برطلة وقد عليه ببيعة أهل مكة شرفها الله وتلا قصيدة من إنشاء أبي محمد عبد الحق بن سبعين الصوفي المشهور ووقف القاضي أبو القاسم بن البراء المذكور على منبر جامع الزيتونة يوم قراءتها موقفا مشهورا وذلك سنة 659 ه واتسع ملكه وقوي سلطانه وأباد مخالفيه وقيل في هاته البيعة:
When Abu Zakariyyaʾ perished, the notables pledged allegiance to his son Muhammad, gave him the title al-Mustansir and called him the Amir. He was famed for excellence, moderation, good conduct, knowledge and praiseworthy qualities, and his renown flew to the horizons. In his days knowledge was a brimming sea and a dazzling moon; his state rose high, and the frontiers of the far lands stretched out to him the hand of seeking protection. There gathered at his court, from among the eminent scholars who came to him and to his father, especially from al-Andalus, consummate poets, eloquent secretaries, accomplished scholars and most pious kings [?], sheltering in the shade of his kingdom and seeking refuge with him; among them Hazim, who praised him with his famous Maqsura, Abu l-Hasan ibn Saʿid, Ibn al-Abbar and their like. Abu Muhammad ʿAbd al-Haqq ibn Burtula came to him with the oath of allegiance of the people of Mecca — may God ennoble it — and recited a poem composed by Abu Muhammad ʿAbd al-Haqq ibn Sabʿin, the famous Sufi; and the qadi Abu l-Qasim ibn al-Baraʾ, mentioned before, stood on the minbar of the Zaytuna mosque on the day it was read, a famous stand. That was in the year 659 AH. His kingdom widened, his authority grew strong and he destroyed his opponents. It was said about this oath of allegiance:
اهنأ أمير المؤمنين ببيعة ... وافتك بالإقبال والإسعاد
Rejoice, Commander of the Faithful, in an oath of allegiance ... that has come to you with good fortune and felicity.
فلقد حباك بملكه رب الورى ... فأتى يبشر بافتتاح بلاد
For the Lord of mankind has bestowed on you His kingdom ... and it has come bringing good tidings of the conquest of lands.
وإذا أتت أم القرى منقادة ... فمن المبرة طاعة الأولاد
And when the Mother of Towns comes submissive ... then the obedience of children is part of filial piety.