Allah, the Blessed and Exalted, says: "O you who believe! When you meet those who disbelieve face to face on the battlefield, do not turn your backs to them." [Surah al-Anfal: 15] (to the end of the verse)
And He said: "O Prophet! Urge the believers to fight." [Surah al-Anfal: 65] to the end of the two verses.
Sayyiduna Abu Hurayrah (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "Avoid the seven destructive things." They said: O Messenger of Allah, what are they? He (peace and blessings be upon him) mentioned them, and one of them is "fleeing on the day of battle."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السير / 18077