Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) said: The Messenger of Allah (peace and blessings be upon him) sent us in a detachment. We met the enemy, and the Muslims fled, and I was among those who fled. I said to myself: We will not enter Madinah, for we have returned with the anger of Allah. Then we said: We will enter it and get provisions from it. We entered Madinah, and the Prophet (peace and blessings be upon him) was coming out for the prayer, and we met him. We said: We are the ones who fled. He (peace and blessings be upon him) said: "No, rather you are the ones who turn back to fight." We said: O Prophet of Allah, we had intended not to enter Madinah and to set out by sea. He (peace and blessings be upon him) said: "Do not do that, for I am the group of every Muslim."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18083