As we have seen, one of the important themes of Hamlet is the connection between the health of a state and the moral legitimacy of its ruler. Claudius is rotten, and, as a result, Denmark is rotten too. Here, at the beginning of Act IV, scene v, things have palpably darkened for the nation: Hamlet is gone, Polonius is dead and has been buried in secret, Ophelia is raving mad, and, as Claudius tells us, the common people are disturbed and murmuring among themselves. This ominous turn of events leads to the truncated, miniature rebellion that accompanies Laertes' return to Denmark. Acting as the wronged son operating with open fury, Laertes has all the moral legitimacy that Claudius lacks, the legitimacy that Hamlet has forfeited through his murder of Polonius and his delay in avenging his father's death.
Laertes is Hamlet's best foil throughout the play, and in this scene the contrast between the two, each of whom has a dead father to avenge, reaches its peak. (A third figure with a dead father to avenge, Fortinbras, lurks on the horizon.) Whereas Hamlet is reflective and has difficulty acting, Laertes is active and has no use for thought. He has no interest in moral concerns, only in his consuming desire to avenge Polonius. When Claudius later asks Laertes how far he would go to avenge his father, Laertes replies that he would slit Hamlet's throat in the church (IV.vii.98). This statement, indicating his willingness to murder Hamlet even in a sacred place of worship, brings into sharp relief the contrast between the two sons: recall that Hamlet declined to kill Claudius as the king knelt in prayer (III.iii).
As befits a scene full of anger and dark thoughts, Act IV, scene v brings a repetition of the motif of insanity, this time through the character of Ophelia, who has truly been driven mad by the death of her father. Shakespeare has demonstrated Ophelia's chaste dependence on the men in her life; after Polonius's sudden death and Hamlet's subsequent exile, she finds herself abruptly without any of them. Ophelia's lunatic ravings reveal a great deal about the nature of her mind at this stage in her young life. She is obsessed with death, beauty, and an ambiguous sexual desire, expressed in startlingly frank imagery:
Young men will do't, if they come to't,
By Cock, they are to blame.
'Before you tumbled me,
You promised me to wed.'
Some readers have interpreted passages such as these, combined with Hamlet's sexually explicit taunting of Ophelia in Act III, scene ii, as evidence that Ophelia's relationship with Hamlet was sexual in nature. Of course, this is impossible to conclude with any certainty, but from these lines it is apparent that Ophelia is grappling with sexuality and that her sexual feelings, discouraged by her father, her brother, and her society, are close to the forefront of her mind as she slips into insanity. But, most important, Ophelia's insanity is designed to contrast strongly with Hamlet's, differing primarily in its legitimacy: Ophelia does not feign madness to achieve an end, but is truly driven mad by external pressures. Many of the worst elements in Denmark, including madness, fear, and rebellion, so far have been kept hidden under various disguises, such as Hamlet's pretense and Claudius's court revelry, and are now beginning to emerge into the open.
After exiling Hamlet to England in Act IV, scene iv, Shakespeare now returns him to Denmark only two scenes later through the bizarre deus ex machina—an improbable or unexpected device or character introduced to resolve a situation in a work of fiction or drama—of the pirate attack. The short Act IV, scene vi is primarily devoted to plot development, as Horatio reads Hamlet's letter narrating his adventure. The story of the pirate attack has little to do with the main themes of the play, but it does provide an interesting variation on the idea of retributive justice, since instead of punishing someone for doing something wrong, Hamlet states his intention to reward the pirates for the right they have done in returning him to Denmark. "They have dealt with me like thieves of mercy," he says, "but they knew what they did: I am to do a good turn for them" (IV.vi.17-19). Additionally, Hamlet's letter features a return of the motif of ears and hearing, as the prince tells Horatio that "I have words to speak in thine ear will make thee dumb," an open reference to the poison poured into King Hamlet's ear by the murderous Claudius (IV.vi.21).