The Messenger of Allah ﷺ set out to perform Umrah, but the disbelievers of Quraysh blocked him from reaching the House. So he sacrificed his offering and shaved his head at Hudaybiyah, and he made an agreement with them that he would perform Umrah the following year, that he would not bring any weapons against them except swords, and that he would not stay in Mecca longer than they wished.The following year he performed Umrah and entered Mecca according to the terms of the agreement he had made with them. After he had stayed there three days, they ordered him to leave, so he left.
أن رسول الله ﷺ خرج معتمرا، فحال كفارقريش بينه وبين البيت، فنحر هديه، وحلق رأسه بالحديبية، وقاضاهم على أن يعتمر العام المقبل، ولا يحمل صلاحا عليهم إلا سبوفا، ولا يقيم بها إلا ما أحبوا، فاعتمر من العام المقبل، فدخلها كما كان صالحهم، فلما أن أقام بها ثلانا أمروه أن يخرج، فخرج.
Bukhari narrated it in Al-Maghazi (4252) from Muhammad bin Rafi, who said, Siraj told us, and from Muhammad bin Husayn bin Ibrahim who said, my father told me, both of them said, Fulayh bin Sulayman told us, from Nafi, from Ibn Umar who said, and then he mentioned it.