In Act 3, Scene 3, Hamlet comes upon Claudius at his prayers. Hamlet has just witnessed proof at the play called "The Mousetrap" that Claudius is guilty of murderiing his father in order to usurp the throne and marry Gertrude. Nothing should prevent Hamlet from carrying out his intention, his vow, and his obligation to kill Claudius right then and there. Hamlet will never have a better opportunity to do the deed. He could even leave the King's body and pretend to know nothing about the murder. That would make it possible for him to become king himself, especially since Claudius has publicly proclaimed in Act 1, Scene 2:
We pray you, throw to earth
This unprevailing woe, and think of us
As of a father: for let the world take note,
You are the most immediate to our throne;
Hamlet's best plan would be to kill Claudius while the King was all alone, and then claim the throne. But he finds yet another excuse for procrastinating.
Now might I do it pat, now he is praying;
And now I'll do't.
Hamlet actually draws his sword when he says, "And now I'll do it." But characteristically he is inhibited by his one tragic flaw, which is his addiction to cerebral activity of all kinds, including meditation, speculation, recollection, deduction, ratiocination, and self-reproach. He draws his sword and then puts it up again, saying to himself:
And so he goes to heaven;
And so am I revenged. That would be scann'd:
A villain kills my father; and for that,
I, his sole son, do this same villain send
Up, sword; and know thou a more horrid hent:
When he is drunk, asleep, or in his rage,
Or in the incestuous pleasure of his bed;
At gaming, swearing, or about some act
That has no relish of salvation in't;
Then trip him, that his heels may kick at heaven,
And that his soul may be as damn'd and black
As hell, whereto it goes. My mother stays:
This physic but prolongs thy sickly days.
The audience might be justified in concluding that Hamlet is not really sincere, because now he sounds too vicious. Before this scene he did not seem sufficiently motivated to kill Claudius, but now he acts as if he is so full of hatred that he wants to inflict the direst possible punishment. It is hard to sympathize with Hamlet at this point. Wouldn't it be sufficient to kill the king, free his mother from what he considers an incestuous marriage, and assume the throne himself?
Hamlet might have understood--as the audience does--that Claudius could not be praying effectively but only trying to pray without achieving any feeling of heavenly forgiveness. As Claudius admits:
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?
One effect of Hamlet's drawing his sword is to show the audience that he has got one. His having a sword will terrorize his mother when she thinks he intends to murder her and she starts screamiing for the guards. It will also make it plausible for him to use it to kill Polonius, who is also shouting for the guards in his hiding place behind the tapestry. The murder of Polonius will lead to Ophelia's insanity and suicide, Laertes' attack on Claudius, and Hamlet's death after Laertes stabs him with the poisoned foil.