The Ghost of his father tells Hamlet that he was murdered by poison poured into his ear by Claudius. The Ghost urges Hamlet to avenge him, but to leave judgment of his mother to heaven. As the Ghost leaves, Hamlet swears to remember his father. Hamlet refuses to divulge the conversation to Horatio and Marcellus when they appear, and the Ghost reappears, repeatedly crying for them to “Swear” not to tell what they have seen. Hamlet also instructs them not to reveal the truth if he appears to be acting “odd” later on, and they finally so swear. Hamlet laments his appointed role as avenger of so great a wrong.
That the Ghost swears the soldiers to secrecy puts an extra burden on Hamlet. His mission to avenge his father may require him to do things which will appear odd or, as it turns out, insane, to onlookers. But the men who could explain his behavior are sworn not to reveal its cause. Further, Hamlet is sworn to leave his mother’s judgment to heaven. Thus, Hamlet is admonished against releasing anger at his mother, yet obliged to pursue revenge against Claudius in ways that may seem illogical and unwarranted. His resulting mental anguish seems inevitable.