Samuel Judges Israel
If ye do return unto the Lord with all your hearts, then put away the strange gods and Ashtaroth from among you, and prepare your hearts unto the Lord, and serve him only: and he will deliver you out of the hand of the Philistines. 1 Samuel 7:3
The action in this chapter takes place some 20 years after the defeat of Aphek. In these two decades, Samuel has become Israel’s acknowledged leader. He has also moved the people to a fresh commitment to God (3, 4).
3 And Samuel spake unto all the house of Israel, saying, If ye do return unto the Lord with all your hearts, then put away the strange gods and Ashtaroth from among you, and prepare your hearts unto the Lord, and serve him only: and he will deliver you out of the hand of the Philistines. 4 Then the children of Israel did put away Baalim and Ashtaroth, and served the Lord only.
When all Israel gathers at Mizpah for fasting and commitment, the Philistines attack, seeking to break up what they view as a dangerous unity movement in the subjugated people. The Philistines are fought and defeated, as the Lord battles for Israel as in old times (10-12). The victory drives the Philistines out of Hebrew territory, and they are never able to occupy Israel’s land again (13).
10 And as Samuel was offering up the burnt offering, the Philistines drew near to battle against Israel: but the Lord thundered with a great thunder on that day upon the Philistines, and discomfited them; and they were smitten before Israel. 11 And the men of Israel went out of Mizpeh, and pursued the Philistines, and smote them, until they came under Bethcar. 12 Then Samuel took a stone, and set it between Mizpeh and Shen, and called the name of it Ebenezer,  saying, Hitherto hath the Lord helped us.
13 So the Philistines were subdued, and they came no more into the coast of Israel: and the hand of the Lord was against the Philistines all the days of Samuel. 14 And the cities which the Philistines had taken from Israel were restored to Israel, from Ekron even unto Gath; and the coasts thereof did Israel deliver out of the hands of the Philistines. And there was peace between Israel and the Amorites. 15 And Samuel judged Israel all the days of his life. 16 And he went from year to year in circuit  to Bethel, and Gilgal, and Mizpeh, and judged Israel in all those places. 17 And his return was to Ramah; for there was his house; and there he judged Israel; and there he built an altar unto the Lord.