So the men of Kiriath-jearim came to get the Ark of the LORD. They took it to the hillside home of Abinadab and ordained Eleazar, his son, to be in charge of it.
The Ark remained in Kiriath-jearim for a long time -- twenty years in all. During that time, all Israel mourned because it seemed that the LORD had abandoned them.
Then Samuel said to all the people of Israel, "If you are really serious about wanting to return to the LORD, get rid of your foreign gods and your images of Ashtoreth. Determine to obey only the LORD; then he will rescue you from the Philistines."
So the Israelites destroyed their images of Baal and Ashtoreth and worshiped only the LORD.
Then Samuel told them, "Come to Mizpah, all of you. I will pray to the LORD for you."
So they gathered there and, in a great ceremony, drew water from a well and poured it out before the LORD. They also went without food all day and confessed that they had sinned against the LORD. So it was at Mizpah that Samuel became Israel's judge.
When the Philistine rulers heard that all Israel had gathered at Mizpah, they mobilized their army and advanced. The Israelites were badly frightened when they learned that the Philistines were approaching.
"Plead with the LORD our God to save us from the Philistines!" they begged Samuel.
So Samuel took a young lamb and offered it to the LORD as a whole burnt offering. He pleaded with the LORD to help Israel, and the LORD answered.
Just as Samuel was sacrificing the burnt offering, the Philistines arrived for battle. But the LORD spoke with a mighty voice of thunder from heaven, and the Philistines were thrown into such confusion that the Israelites defeated them.
The men of Israel chased them from Mizpah to Beth-car, slaughtering them all along the way.
Samuel then took a large stone and placed it between the towns of Mizpah and Jeshanah. He named it Ebenezer -- "the stone of help" -- for he said, "Up to this point the LORD has helped us!"
References for 1 Samuel 7:12
So the Philistines were subdued and didn't invade Israel again for a long time. And throughout Samuel's lifetime, the LORD's powerful hand was raised against the Philistines.
The Israelite towns near Ekron and Gath that the Philistines had captured were restored to Israel, along with the rest of the territory that the Philistines had taken. And there was also peace between Israel and the Amorites in those days.
Samuel continued as Israel's judge for the rest of his life.
Each year he traveled around, setting up his court first at Bethel, then at Gilgal, and then at Mizpah. He judged the people of Israel at each of these places.
Then he would return to his home at Ramah, and he would hear cases there, too. And Samuel built an altar to the LORD at Ramah.