Israel is defeated because they have not obeyed God’s instructions. They didn’t realize God was no longer with them because they took God’s love for them for granted. They needed to fix their relationship with God before he could give them victory.
How often do we wander from our relationship with God without knowing it? We know God loves us, but we can’t expect him to go along with our plans when we don’t obey him.