Ibn Umar (may Allah be pleased with them both) narrated that the Messenger of Allah (ﷺ) sent us on a military expedition. When we encountered the enemy, the people fled. We came to Madinah, opened its gates, and said: "O Messenger of Allah (ﷺ)! We are those who fled (from the battlefield)." So he (ﷺ) said: "(No), rather you are those who returned to your leader for refuge, and I am the refuge of the Muslims."
Hadith Referenceمسند الإمام الشافعي / كتاب الجهاد وقسم الغنائم / 1731
Hadith Takhrijاسناده ضعيف لضعيف يزيد بن ابی زیاد اخرجه أبو داود : الجهاد، باب في التولى يوم الزحف (2647) ۔ والترمذى، الجهاد، باب ماجاء في الغرار من الزحف (1716)۔