Quran 47:35 – “Be not weary and faint-hearted, crying for peace, when ye should be uppermost for Allah is with you,”
Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an
The conditions at the time when this Surah was sent down were such that the Muslims were being made the target of persecution and tyranny in Makkah in particular and in Arabia in general, and life had become miserable for them. Although the Muslims had emigrated to the haven of Madinah from every side, the disbelieving Quraish were not prepared to leave them alone and let them live in peace even there.
Thus, the small settlement of Madinah was hemmed in by the enemy, who was bent upon exterminating it completely.
The only alternative left with the Muslims were that either they should surrender to the forces of ignorance, giving up their mission of preaching the true Faith, or even following it in their private lives, or should rise to wage a war at the cost of their lives to settle finally and for ever whether Islam would stay in Arabia or the creed of ignorance.
On this occasion Allah showed the Muslims the same way of resolution and will, which is the only way for the true believers. He first permitted them to fight in Surah Al Hajj 39 and then enjoined fighting in Al Baqarah 190.
But at that time everyone knew fully well what it meant to wage a war in those conditions. There were only a handful of Muslims in Madinah, who could not muster even a thousand soldiers; yet they were being urged to take up the sword and clash against the pagan forces of the whole of Arabia.
Then the kind of the weapons needed to equip its soldiers for war could hardly be afforded by the town in which hundreds of emigrants were still homeless and unsettled even by resort to starving its members at a time when it had been boycotted economically by the Arabs on all sides. 
40 I.e, even if the fortunes of war go against them, the consciousness of having fought in the cause, of truth and justice is bound to enhance the inner strength of the believers and, thus, to become a source of their future greatness: cf. 3:139. 
 Sayyid Abul Ala Maududi – Tafhim al-Qur’an – The Meaning of the Qur’an – http://www.englishtafsir.com/Quran/47/
 The Message of The Quran translated and explained by Muhammad Asad page 1073