If with all your hearts you would come back to the Lord, and be servants to him only: he will make you safe from the hands of the enemy.

Repent, and turn back to God

Then Samuel said to all Israel, If with all your hearts you would come back to the Lord, then put away all the strange gods and the Astartes from among you, and let your hearts be turned to the Lord, and be servants to him only: and he will make you safe from the hands of the Philistines.
1 Samuel 7:3