Judges 13: 3-5, 7 (NIV), “The angel of the LORD appeared to her and said, ‘You are barren and childless, but you are going to become pregnant and give birth to a son. Now see to it that you drink no wine or other fermented drink and that you do not eat anything unclean. You will become pregnant and have a son whose head is never to be touched by a razor because the boy is to be a Nazirite, dedicated to God from the womb. He will take the lead in delivering Israel from the hands of the Philistines.’..’You will become pregnant and have a son. Now then, drink no wine or other fermented drink and do not eat anything unclean, because the boy will be a Nazirite of God from the womb until the day of his death.’”
In these verses, the angel of the Lord told Samson’s mother that she would bear a son who would begin the delivery of Israel out from Philistine rule. As a part of this special position, Samson was to be dedicated to God’s service under the Nazirite vow from conception until his death. Numbers 6;1- 21 gives all the many specifications of the Nazirite vow, one of which includes letting the person’s hair grow long. The long hair was the outward symbol of the person’s Nazirite vow, “the hair that symbolizes their dedication…”(Numbers 6:18 NIV). Therefore, Samson needed to keep his Nazirite vow with his long hair to serve as Israel’s deliverer.
When Samson told Delilah that his strength came from his hair, he was essentially declaring his strength came from keeping the Nazirite vow and living in obedience to God’s will. When Samson’s hair was cut, he broke his vow. He lost his special strength.
Judges 16:21, 22,”Then the Philistines seized him, gouged out his eyes and took him down to Gaza. Binding him with bronze shackles, they set him to grinding grain in the prison. But the hair on his head began to grow again after it had been shaved.”
While in prison, Samson must have rededicated himself to the Lord (as symbolized by his growing hair). He prayed for the opportunity to serve God's cause one last time: "Oh Lord God, remember me…and strengthen me…only this once, O God," Judges 16:28. The Lord granted this prayer, and permitted Samson to pull down the pillars of the pagan building in which the Philistines mocked him and used him for sport. More than 3,000 Philistines, Israel's enemies, were slain.
In summary: God called Samson to the office of deliverer for Israel. Part of the qualifications for this office was keeping the Narizite vow. In order to fulfill his office, God gave Samson his amazing strength. But when Samson broke his vow, he lost his strength. While in prison, God honored Samson’s recommitment to doing God’s will. God then granted Samson this powerful strength again to slay 3,000 Philistines.