Bara bin Azib reported,

The Messenger of Allah ﷺ set out to perform Umrah in the month of Dhul-Qadah, but the people of Makkah refused to let him enter the city until he reached an agreement with them allowing him to stay there for three days.When they came to write the document, the Prophet ﷺ dictated, "This is what Muhammad, the Messenger of Allah, has agreed upon."They objected, "We do not accept this. If we knew you were the Messenger of Allah, we would not have prevented you from anything. Rather, you are Muhammad bin Abdullah."He replied, "I am the Messenger of Allah, and I am Muhammad bin Abdullah."Then he said to Ali, "Erase 'Messenger of Allah.'"Ali said, "By Allah, I will never erase you."So the Prophet ﷺ took the document, though he did not know how to write, and in place of "Messenger of Allah" he wrote, "This is what Muhammad bin Abdullah has agreed upon, that no weapons shall be brought into Makkah except swords in their sheaths, that none of its people shall leave with him except those who wish to follow him, and that he shall not prevent any of his companions from remaining there."When he entered Makkah and the term had passed, they came to Ali and said, "Tell your companion to depart from us, for the term has expired."So the Messenger of Allah ﷺ departed.

Ahmad 18635

Sahih

حدثنا حجين حدثنا إسرائيل عن أبي إسحاق

عن البراء قال

اعتمر رسول الله ﷺ في ذي القعدة فأبى أهل مكة أن يدعوه يدخل مكة حتى قاضاهم على أن يقيم بها ثلاثة أيام فلما كتبوا الكتاب كتبوا هذا ما قاضى عليه محمد رسول الله قالوا لا نقر بهذا لو نعلم أنك رسول الله ما منعناك شيئا ولكن أنت محمد بن عبد الله قال أنا رسول الله وأنا محمد بن عبد الله قال لعلي امح رسول الله قال والله لا أمحوك أبدا فأخذ النبي ﷺ الكتاب وليس يحسن أن يكتب فكتب مكان رسول الله هذا ما قاضى عليه محمد بن عبد الله أن لا يدخل مكة السلاح إلا السيف في القراب ولا يخرج من أهلها أحد إلا من أراد أن يتبعه ولا يمنع أحدا من أصحابه أن يقيم بها فلما دخلها ومضى الأجل أتوا عليا فقالوا قل لصاحبك فليخرج عنا فقد مضى الأجل فخرج رسول الله ﷺ

أحمد 18635صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Bara bin Azib
Numbering
Darussalam 18635
Ahmad 18635