It was revealed to the Prophet ﷺ on his return from Hudaybiyyah, while his companions were filled with sorrow and dejection, having been barred from reaching their homes and having sacrificed their offerings at Hudaybiyyah, the verse, "Indeed, We have granted you a clear conquest" up to His words "a straight path" [Fath 48:1–2].He said, "Two verses have been revealed to me that are dearer to me than the entire world."When he recited them, a man said, "Congratulations and blessings, Prophet of Allah. Allah has made clear what He will do for you, but what will He do for us?"So Allah revealed the verse that follows, "That He may admit the believing men and believing women into gardens beneath which rivers flow" [Fath 48:5], to the end of the verse.
حدثنا بهز حدثنا همام عن قتادة
نزلت على النبي ﷺ مرجعه من الحديبية وأصحابه يخالطون الحزن والكآبة وقد حيل بينهم وبين مساكنهم ونحروا الهدي بالحديبية {إنا فتحنا لك فتحا مبينا} إلى قوله {صراطا مستقيما} قال لقد أنزلت علي آيتان هما أحب إلي من الدنيا جميعا قال فلما تلاهما قال رجل هنيئا مريئا يا نبي الله قد بين الله لك ما يفعل بك فما يفعل بنا فأنزل الله عز وجل الآية التي بعدها {ليدخل المؤمنين والمؤمنات جنات تجري من تحتها الأنهار} حتى ختم الآية