The story of Hamlet was based on the story of Amleth.
Horwendil, King of Denmark, married Gurutha and she bore him a son, whom they named Amleth. Horwendil's good fortune stung his brother Feng with jealousy. So when he got the chance to murder his brother, he took it. Then he married the wife of the brother he murdered.
Amleth pretends to be mad... he clothes himself in rags and speaks nonsense to shield himself from his uncle's violence.
However, Amleth's behaviour attracts suspicion, and the King attempts to trap him into admitting he has plans for revenge.
Yet Amleth’s behaviour attracts suspicion, and the King attempts to trap him into admitting he has plans for revenge. First, a beautiful woman is used to lure him into betraying himself, but she proves loyal to Amleth. Then a spy is planted to eavesdrop on Amleth’s conversation with his mother, in which she repents and he confesses his plans for revenge.
Amleth detects the spy, kills him in a crazy state, throws his mutilated body in a sewer, and leaves it to be eaten by pigs. Fengo then deports Amleth to England with two escorts carrying a letter directing the King there to execute him. Amleth switches the letter with another one, which orders the death of the escorts and asks for the hand of the English Princess in marriage.
Returning to Denmark, Amleth arrives disguised, in the midst of his own funeral, burns down the hall and hunts down his sleeping uncle. Amleth swaps this useless sword with Fengo’s, succeeds in killing his uncle and next day is hailed as the King.