Certainly, with the prevalence of "something rotten in the state of Denmark," there is a milieu of evil in the Danish court. And, it is this evil about which Hamlet often deliberates.
1. In Act I, Hamlet responds to the ghost of his father's report of his poisoning by Claudius with outrage,
"O, horrible! O, horrible! most horrible!"(1.5.85).
Then, he vows revenge and condemns Gertrude and Claudius in his second soliloquy:
And your commandment all by itself shall live
Within the book and volume of my brain,
O most pernicious woman!
O villain, villain, smiling, damned villain!
At least, I am sure, it may be so in Denmark.
So, uncle, there you are. Now to my word:
It is Goodbye, goodbye! remember me. '
I have sworn it. (1.5.107-116)
2. Yet, at the same time, in this first act and scene, Hamlet has misgivings as he feels that "The time is out of joint" and rues that he was "ever born to set it [his father's death] right." So, he does not seek revenge against evil immediately.
3. While Hamlet deliberates, mired in his melancholy, Rosencrantz and Guildenstern come to him in Act II, Scene 2. Suspecting that they have been turned against him, Hamlet confronts them in their evil intentions,
Were you not sent for? Is it your own inclin-
ing? Is it a free visitation? Come, deal justly with me.
Come, come! Nay, speak. (2.2.281-283)
He tells his former friends that there is "a kind of confession" in their looks, and they admit to having been assigned to find out what bothers Hamlet.
4. In order to ascertain if Claudius has, indeed, committed regicide, Hamlet hires the players to perform a "speech" in their play based upon the information that his father's ghost has provided. In Act III, Scene 2, Hamlet then, asks Horatio to observe Claudius and Gertrude as they listen to this speech. When Claudius bolts from his seat, Hamlet is convinced that his uncle is guilty of killing King Hamlet. Having dealt with his suspicions of evil, Hamlet determines to act against Claudius. He also agrees to speak with Gertrude.
5. In Act III, Scene 3, Hamlet observes Claudius alone as he prays; he overhears Claudius:
But, O, what form of prayer
Can serve my turn? 'Forgive me my foul murder?'
That cannot be; since I am still possess'd
Of those effects for which I did the murder—
My crown, mine own ambition, and my queen.
May one be pardon'd and retain the offence? (3.3.53-58)
Now convinced that Claudius has murdered his father, Hamlet considers killing this evil man; however, he is stayed by his reflection,
Now might I do it just like that, now that he is praying,
And now I’ll do it, and so he goes to heaven,
And so am I revenged. I must think about that. (3.3.75-77)
Hamlet agonizes that if he rids Denmark of Claudius while he prays, then Claudius will become a martyr and go to heaven. Therefore, Hamlet does not then act against Claudius.
6. When Hamlet goes to the chambers of his mother, the duplicitous Polonius hides behind the arras. As Hamlet confronts his mother, Gertrude fears that he may kill her and she calls out; Polonius moves and Hamlet kills the hypocrite. Then, he speaks to his mother is a most accusatory manner. He tells her
Confess yourself to heaven;
Repent what's past; avoid what is to come. (3.4.165)
Hamlet apologizes for killing Polonius, but he was a "foolish, prating knave"; he urges his mother to not go to Claudius and to abstain from wifely acts with this evil man. As he departs, he tells Gertrude,
I must be cruel, only to be kind.
Thus bad begins, and worse still remains.
Clearly, Prince Hamlet is a rational man who responds to evil with deliberation.