Language:
كتاب الجزية والموادعة
58  
Jizyah and Mawaada'ah
(19)
Chapter: It is permissible to conclude a peace treaty of three days or any other fixed period
(19)
باب الْمُصَالَحَةِ عَلَى ثَلاَثَةِ أَيَّامٍ، أَوْ وَقْتٍ مَعْلُومٍ
Sahih al-Bukhari 3184

Narrated Al-Bara:

When the Prophet (ﷺ) intended to perform the `Umra he sent a person to the people of Mecca asking their permission to enter Mecca. They stipulated that he would not stay for more than three days and would not enter it except with sheathed arms and would not preach (Islam) to any of them. So `Ali bin Abi- Talib started writing the treaty between them. He wrote, "This is what Muhammad, Apostle of Allah has agreed to." The (Meccans) said, "If we knew that you (Muhammad) are the Messenger of Allah, then we would not have prevented you and would have followed you. But write, 'This is what Muhammad bin `Abdullah has agreed to..' " On that Allah's Messenger (ﷺ) said, "By Allah, I am Muhammad bin `Abdullah, and, by Allah, I am Apostle of 'Allah." Allah's Messenger (ﷺ) used not to write; so he asked `Ali to erase the expression of Apostle of Allah. On that `Ali said, "By Allah I will never erase it." Allah's Apostle said (to `Ali), "Let me see the paper." When `Ali showed him the paper, the Prophet (ﷺ) erased the expression with his own hand. When Allah's Messenger (ﷺ) had entered Mecca and three days had elapsed, the Meccans came to `Ali and said, "Let your friend (i.e. the Prophet) quit Mecca." `Ali informed Allah's Messenger (ﷺ) about it and Allah's Messenger (ﷺ) said, "Yes," and then he departed.

حَدَّثَنَا أَحْمَدُ بْنُ عُثْمَانَ بْنِ حَكِيمٍ، حَدَّثَنَا شُرَيْحُ بْنُ مَسْلَمَةَ، حَدَّثَنَا إِبْرَاهِيمُ بْنُ يُوسُفَ بْنِ أَبِي إِسْحَاقَ، قَالَ حَدَّثَنِي أَبِي، عَنْ أَبِي إِسْحَاقَ، قَالَ حَدَّثَنِي الْبَرَاءُ ـ رضى الله عنه أَنَّ النَّبِيَّ صلى الله عليه وسلم لَمَّا أَرَادَ أَنْ يَعْتَمِرَ أَرْسَلَ إِلَى أَهْلِ مَكَّةَ يَسْتَأْذِنُهُمْ لِيَدْخُلَ مَكَّةَ، فَاشْتَرَطُوا عَلَيْهِ أَنْ لاَ يُقِيمَ بِهَا إِلاَّ ثَلاَثَ لَيَالٍ، وَلاَ يَدْخُلَهَا إِلاَّ بِجُلُبَّانِ السِّلاَحِ، وَلاَ يَدْعُوَ مِنْهُمْ أَحَدًا، قَالَ فَأَخَذَ يَكْتُبُ الشَّرْطَ بَيْنَهُمْ عَلِيُّ بْنُ أَبِي طَالِبٍ، فَكَتَبَ هَذَا مَا قَاضَى عَلَيْهِ مُحَمَّدٌ رَسُولُ اللَّهِ‏.‏ فَقَالُوا لَوْ عَلِمْنَا أَنَّكَ رَسُولُ اللَّهِ لَمْ نَمْنَعْكَ وَلَبَايَعْنَاكَ، وَلَكِنِ اكْتُبْ هَذَا مَا قَاضَى عَلَيْهِ مُحَمَّدُ بْنُ عَبْدِ اللَّهِ‏.‏ فَقَالَ ‏"‏ أَنَا وَاللَّهِ مُحَمَّدُ بْنُ عَبْدِ اللَّهِ وَأَنَا وَاللَّهِ رَسُولُ اللَّهِ ‏"‏‏.‏ قَالَ وَكَانَ لاَ يَكْتُبُ قَالَ فَقَالَ لِعَلِيٍّ ‏"‏ امْحُ رَسُولَ اللَّهِ ‏"‏‏.‏ فَقَالَ عَلِيٌّ وَاللَّهِ لاَ أَمْحَاهُ أَبَدًا‏.‏ قَالَ ‏"‏ فَأَرِنِيهِ ‏"‏‏.‏ قَالَ فَأَرَاهُ إِيَّاهُ، فَمَحَاهُ النَّبِيُّ صلى الله عليه وسلم بِيَدِهِ، فَلَمَّا دَخَلَ وَمَضَى الأَيَّامُ أَتَوْا عَلِيًّا فَقَالُوا مُرْ صَاحِبَكَ فَلْيَرْتَحِلْ‏.‏ فَذَكَرَ ذَلِكَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏"‏ نَعَمْ ‏"‏ ثُمَّ ارْتَحَلَ‏.‏
Reference : Sahih al-Bukhari 3184
In-book reference : Book 58, Hadith 26
USC-MSA web (English) reference : Vol. 4, Book 53, Hadith 408
  (deprecated numbering scheme)