Sahih Bukhari | Volume 3 | Hadith Number 864

Narrated by Ibn 'Umar
Allah's Apostle set out for the 'Umra but the pagans of Quraish prevented him from reaching the Ka'ba. So, he slaughtered his sacrifice and got his head shaved at Al- Hudaibiya, and agreed with them that he would perform 'Umra the following year and

would not carry weapons except swords and would not stay in Mecca except for the period they al lowed. So, the Prophet performed the 'Umra in the following year and entered Mecca according to the treaty, and when he stayed for three days, the pagans ordered him to depart, and he departed.