The situation is described in the qur'an in surat al-Anfal as follows:
And [remember] when He showed them to you, when you met, as few in your eyes, and He made you [appear] as few in their eyes so that Allah might accomplish a matter already destined. And to Allah are [all] matters returned. (8:44)
One could try to explain that showing the Kufar few in the eyes of the believers may lead them to having more faith in the possibility of a victory and give them more comfort. But why did Allah show both opponents their opponent as few in their eyes?