I have heard
That guilty creatures sitting at a play
Have by the very cunning of the scene
Been struck so to the soul that presently
They have proclaim'd their malefactions;
For murder, though it have no tongue, will speak
With most miraculous organ. I'll have these players
Play something like the murder of my father
Before mine uncle: I'll observe his looks;
I'll tent him to the quick: if he but blench,
I know my course. The spirit that I have seen
May be the devil: and the devil hath power
To assume a pleasing shape; yea, and perhaps
Out of my weakness and my melancholy,
As he is very potent with such spirits,
Abuses me to damn me: (Act II, scene i)
In Act II, scene i, while speaking of Claudius's guilt in the murder of Hamlet's father, the King of Denmark, Hamlet also reveals some of his own guilt. Hamlet primarily feels guilty for not acting more expeditiously (i.e., quickly) on taking the revenge against his father's murderer that the ghost--of whose source and identity Hamlet is unsure (“The spirit that I have seen
May be the devil”)--has required of him. Guilt notwithstanding, Hamlet's hesitations stem from legitimate moral and religious grounds.
Hamlet is a deeply devoted Reformationist. He is being educated at the Wittenberg University, which is the academic home of Martin Luther, the father of the Protestant Reformation of Catholic doctrine. In Act I, scene ii, Gertrude begs Hamlet to "go not to Wittenberg" after Claudius has declare that he prefers Hamlet not go "back to school in Wittenberg." Two deep precepts to devout believers in God and Reformationists are the injunctions against communing with spirits of people who have died and against taking revenge. A third precept deeply held to is that humans must not end their own lives. Hamlet was forced to do the first, is being asked to do the second, and is voluntarily contemplating the third.
As a result of these, he suffers crippling feelings of guilt. He deals with the first--communing with ghosts--by recognizing that "the devil hath power" to appear in a compelling light. The motive of such an appearance, though, is, as Hamlet says, that the devil "Abuses me to damn me," in other words, to trick Hamlet into carnal sin that will lead to Hamlet's damnation. Hamlet deals with the second--taking revenge--by attempting to gather substantial evidence of Claudius's guilt so that his role will be much more like righteous appointed executioner and less like assassinating avenger. Hamlet deals with the third--taking his own life--in two ways. First he protest against God's precepts, saying,
that the Everlasting had not fix'd
His canon 'gainst self-slaughter! O God! God!
Second, he soliloquizes about the necessity and virtue of death in his famous Act III, scene i, "To be, or not to be" speech. He ends by explaining that the cowardice to face the consequences of such a deed overrides the resolution "To die: to sleep":
Thus conscience does make cowards of us all;
And thus the native hue of resolution
Is sicklied o'er with the pale cast of thought, ....