Khabab, who had witnessed Badr with the Messenger of Allah ﷺ, reported that he watched the Messenger of Allah ﷺ throughout the entire night until dawn. When the Messenger of Allah ﷺ concluded his prayer with the salutation, Khabab came to him and said, "Messenger of Allah, may my father and mother be sacrificed for you, you have prayed tonight a prayer the like of which I have never seen you pray before."The Messenger of Allah ﷺ replied, "Indeed, it was a prayer of hope and fear. I asked my Lord in it for three things, and He granted me two and withheld one. I asked my Lord
not to destroy us by what He destroyed the nations before us, and He granted me that. I asked my Lord
not to let an enemy from outside our ranks prevail over us, and He granted me that. And I asked my Lord not to divide us into warring factions, but He withheld that from me."
أخبرنا عمرو بن عثمان بن سعيد بن كثير قال حدثنا أبي وبقية قالا حدثنا ابن أبي حمزة قال حدثني الزهري قال أخبرني عبيد الله بن عبد الله بن الحارث بن نوفل
وكان قد شهد بدرا مع رسول الله ﷺ أنه راقب رسول الله ﷺ الليلة كلها حتى كان مع الفجر فلما سلم رسول الله ﷺ من صلاته جاءه خباب فقال يا رسول الله بأبي أنت وأمي لقد صليت الليلة صلاة ما رأيتك صليت نحوها فقال رسول الله ﷺ أجل إنها صلاة رغب ورهب سألت ربي عز وجل فيها ثلاث خصال فأعطاني اثنتين ومنعني واحدة سألت ربي عز وجل أن لا يهلكنا بما أهلك به الأمم قبلنا فأعطانيها وسألت ربي عز وجل أن لا يظهر علينا عدوا من غيرنا فأعطانيها وسألت ربي أن لا يلبسنا شيعا فمنعنيها
[Its chain of transmission is sahih] Ahmad narrated it, 5/108, 109, and others, from the hadith of Shuayb bin Abu Hamza with this wording. It is also in al-Kubra, no. 1332. Tirmidhi said, in the Book of Fitnah, chapter on what came regarding the Prophet's ﷺ asking three times concerning his nation, no. 2175, regarding the hadith of Zuhri, hasan gharib sahih. Ibn Hibban graded it sahih, no. 1830. It has other routes narrated by Tirmidhi, no. 2176, and others.