They were defeated because the Israelites cried out to God and put their trust in him, and God responded to them.