When your people Israel are defeated before the enemy because they have sinned against you...
1 Kings 8:33a

No enemy can stand against Israel when she is obedient to God's commandments. She can only be defeated by her own sins, and then her afflictions are meant to be instructive, to bring her to repentance and obedience to God's Law.

Just as national apostasy begins with the sins of individual people, national revival begins with the repentance of individuals. If you want your nation to return to God, start with yourself and your own house.