And Samuel said to all the house of Israel, "If you are returning to the LORD with all your heart, then put away the foreign gods and the Ashtaroth from among you and direct your heart to the LORD and serve him only, and he will deliver you out of the hand of the Philistines." So the people of Israel put away the Baals and the Ashtaroth, and they served the LORD only.
Then Samuel said, "Gather all Israel at Mizpah, and I will pray to the LORD for you." So they gathered at Mizpah and drew water and poured it out before the LORD and fasted on that day and said there, "We have sinned against the LORD." And Samuel judged the people of Israel at Mizpah. Now when the Philistines heard that the people of Israel had gathered at Mizpah, the lords of the Philistines went up against Israel. And when the people of Israel heard of it, they were afraid of the Philistines. And the people of Israel said to Samuel, "Do not cease to cry out to the LORD our God for us, that he may save us from the hand of the Philistines." So Samuel took a nursing lamb and offered it as a whole burnt offering to the LORD. And Samuel cried out to the LORD for Israel, and the LORD answered him. As Samuel was offering up the burnt offering, the Philistines drew near to attack Israel. But the LORD thundered with a mighty sound that day against the Philistines and threw them into confusion, and they were defeated before Israel. And the men of Israel went out from Mizpah and pursued the Philistines and struck them, as far as below Beth-car.
Then Samuel took a stone and set it up between Mizpah and Shen and called its name Ebenezer; for he said, "Till now the LORD has helped us." So the Philistines were subdued and did not again enter the territory of Israel. And the hand of the LORD was against the Philistines all the days of Samuel. The cities that the Philistines had taken from Israel were restored to Israel, from Ekron to Gath, and Israel delivered their territory from the hand of the Philistines. There was peace also between Israel and the Amorites.
Samuel judged Israel all the days of his life. And he went on a circuit year by year to Bethel, Gilgal, and Mizpah. And he judged Israel in all these places. Then he would return to Ramah, for his home was there, and there also he judged Israel. And he built there an altar to the LORD.