The Failure of a Good Man

Description Eli recognized the hand of God in Hannah’s request for a male child. Eli recognized the sin in his sons and confronted them about it. Yet God judged Eli and the judgement was severe. Why? Where did Eli go wrong?
Bible Passage 1 Samuel 3:13
13 For I have told him that I will judge his house for ever for the iniquity which he knoweth; because his sons made themselves vile, and he restrained them not.