I'm looking for two specific sources related to this topic.
where is it written that when the Jews were all "keeping TORAH" but didn't have Ahavat Yisrael, they lost all battles.
where is it written that when the Jews were all idolaters (but i think that this wasn't all the Jews, just the kingdom of israel) but they had Ahavat Yisrael and won every battle.
My details are probably a little off.