Shakespeare was writing Hamlet in the last years of the ailing Queen Elizabeth's reign. With the recently past foreign wars and the impending complication of a monarch dying without an heir he lived in a very uncertain country politically. With the death of the monarch, the country could well be plunged back into a holy war between the Protestants and the Catholics.
In discussing the dramatic potential of Hamlet it is vital to point out the restrictions which Shakespeare was put under about the things he could write. His dealing with a story about kings getting killed could potentially have him arrested and put to death for treason. His company supported the Earl of Essex, who had fallen from Elizabeth's favour and died in 1601. The Earl asked Shakespeare's company to play Richard the Second, a highly controversial work that depicted the killing of the king and was seen as an attempt to stir people into a revolt.
Thus this was no time for obvious examination of the contemporary political situation. This setting makes Shakespeare's play about rotten political bodies a danger to his life and adds to its power.
There are many undertones throughout the play to the court of Queen Elizabeth and its lame-duck nature. The subtle references which he uses, are worded in such a way that allowed Shakespeare to express his opinions without being arrested. There are no direct references to Queen Elizabeth's court, only ambiguous analogies which he hoped the audience would pick up on.
He uses Hamlet's disillusionment with the court of Denmark to allude to his own society. We see the prince in his first soliloquy describe the corruptness of 'this world.' In referring to Denmark and the court as an 'unweeded garden' he was trying to make the audience see the same...