1 Samuel 7 1
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 the LORD had abandoned them.
Samuel Leads Israel to Victory 3
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 got rid of their images of Baal and Ashtoreth and worshiped only the LORD.
Then Samuel told them, "Gather all of Israel to Mizpah, and I will pray to the LORD for you."
So they gathered at Mizpah 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. (It was at Mizpah that Samuel became Israel's judge.)
When the Philistine rulers heard that Israel had gathered at Mizpah, they mobilized their army and advanced. The Israelites were badly frightened when they learned that the Philistines were approaching.
"Don't stop pleading 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 him.
Just as Samuel was sacrificing the burnt offering, the Philistines arrived to attack Israel. But the LORD spoke with a mighty voice of thunder from heaven that day, and the Philistines were thrown into such confusion that the Israelites defeated them.
The men of Israel chased them from Mizpah to a place below 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 (which means "the stone of help"), for he said, "Up to this point the LORD has helped us!"
So the Philistines were subdued and didn't invade Israel again for some time. And throughout Samuel's lifetime, the LORD's powerful hand was raised against the Philistines.
The Israelite villages 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 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.