Allah the Almighty says in the Holy Quran,
يَا أَيُّهَا الَّذِينَ آمَنُوا إِذَا لَقِيتُمُ الَّذِينَ كَفَرُوا زَحْفًا فَلَا تُوَلُّوهُمُ الْأَدْبَارَ
وَمَن يُوَلِّهِمْ يَوْمَئِذٍ دُبُرَهُ إِلَّا مُتَحَرِّفًا لِّقِتَالٍ أَوْ مُتَحَيِّزًا إِلَىٰ فِئَةٍ فَقَدْ بَاءَ بِغَضَبٍ مِّنَ اللَّهِ وَمَأْوَاهُ جَهَنَّمُ ۖ وَبِئْسَ الْمَصِيرُ
O you who have believed, when you meet those who disbelieve in battle, do not turn back [in flight]. وَمَن يُوَلِّهِمْ يَوْمَئِذٍ دُبُرَهُ إِلَّا مُتَحَرِّفًا لِّقِتَالٍ أَوْ مُتَحَيِّزًا إِلَىٰ فِئَةٍ فَقَدْ بَاءَ بِغَضَبٍ مِّنَ اللَّهِ وَمَأْوَاهُ جَهَنَّمُ ۖ وَبِئْسَ الْمَصِيرُ
And whoever turns his back to them on such a day, unless maneuvering for war or joining [another] company, has certainly incurred the wrath of Allah, and his abode is Hell - and wretched is the destination.
Surah Anfaal – verse 15 – 16.
On the first day of the battle of Khaibar, the Prophet (s.a.w.a.) gave the Muslim flag of leadership to Abu Bakr (l.a.), who led the Muslim army against the Jews.
Suffering a defeat after a short battle, he (Abu Bakr (l.a.)) fled with his tail between his legs.
The next day the Muslim flag was given to Umar (l.a.).
But before he reached the place of battle, he (Umar (l.a.)) fled in panic.
The Battle of Khaibar was an important event of the Prophet's life, recorded in detail by historians of both sects. Hafiz Abu Nu'aim Ispahani in his Hilyatu'l-Auliya, Volume I, page 62, Muhammad Bin Talha Shafi'I in Matalibu's-Su'ul, page 40, from the Sira of Ibn Hisham, Muhammad Bin Yusuf Ganji Shafi'i in Kifayatu't-Talib, Chapter 14, and many others Sunni scholars have recorded this event.
But the most authentic narrations are those of two great scholars: Muhammad Bin Isma'il Bukhari, who writes in his Sahih, Volume II, printed in Egypt, 1320 A.H., page 100, and Muslim Bin Hujjaj, who writes in his Sahih, Volume II, printed in Egypt, 1320 A.H., page 324, that
"Caliph Umar fled from the battlefield on two occasions."
Among the many clear proofs on this point are the unambiguous verses of Ibn Abi'l-Hadid the Mu'tazilite, known as "Alawiyyat-e-Sab'a, in praise of Ameerul Momineen Ali ibn Abi Talib (a.s.).
Regarding the "Gate of Khaibar," he says:
Have you heard the story of the Conquest of Khaibar?
So many mysteries are linked together which bewilder even the wise mind!
These two (Abu Bakr and Umar) had no competence or acquaintance with bearing a flag (leading an army).
They did not know the secret of maintaining the honor of a flag,
They covered it with scorn and took to their heels,
Though they knew that fleeing from the battlefield is tantamount to infidelity.
…
Ibn Abi'l-Hadid addressing them (Abu Bakr and Umar) says further: "I apologize for you, for your defeat and fleeing, since everyone dislikes death and loves life. Like all others, you too did not like death although there is no immunity from death. But you could not court death."
In the battles of Uhud and Hunain again Abu Bakr (l.a.) and Umar (l.a.) fled from the battle field like infidels. As reported by Tabrini and others, they left the Prophet alone among the infidels.
Is it possible that those who turned their backs to the enemy leaving the Holy Prophet alone to face the enemy were the loved ones of Allah and His Prophet?
Allah in the Holy Qur'an. says:
وَإِنَّ مِنْ أَهْلِ الْكِتَابِ لَمَن يُؤْمِنُ بِاللَّهِ وَمَا أُنزِلَ إِلَيْكُمْ وَمَا أُنزِلَ إِلَيْهِمْ خَاشِعِينَ لِلَّهِ لَا يَشْتَرُونَ بِآيَاتِ اللَّهِ ثَمَنًا قَلِيلًا ۗ أُولَٰئِكَ لَهُمْ أَجْرُهُمْ عِندَ رَبِّهِمْ ۗ إِنَّ اللَّهَ سَرِيعُ الْحِسَابِ
"O you who believe! Whoever of you turns away from his religion, soon Allah will bring another people; He loves them and they love Him, lowly before the believers, mighty against the infidels, striving hard in Allah's way, and they fear not the censure of any censurer; this is the grace of Allah. He gives it to whomsoever He desires." Surah Ale Imran verse 199
Abu Ishaq Imam Ahmad Tha'labi, writes in his Kashfu'l-Bayan that the above verse was revealed in praise of Ameerul Momineen Ali b. Abi Talib (a.s.) because no other person possessed the attributes mentioned in it. In the Battle of Uhud, when Abu Bakr (l.a.) and Umar (l.a.) and other companions fled, and the enemy's 5,000 troops attacked the Muslims, the only person who stayed with the Holy Prophet (s.a.w.a.) until victory was achieved was Ameerul Momineen Ali b. Abi Talib (a.s.).
In the Battle of Hunain, Hamidi in his Jam'-e-Bainu's-Sahihain and Halabi in his Siratu'l- Halabiyya, Volume III, page 123, say that Abu Bakr (l.a.), Umar (l.a.) and other companions fled, except four: Ameerul Momineen Ali b. Abi Talib (a.s.) and Abbas, who were in front of the Prophet, Abu Sufyan b. Harith held the reins of the Prophet's horse, and Abdullah b. Mas'ud stood on his left.