Even though Hamlet was presented with several opportunities to have killed Claudius, he didn’t. This is because he thought killing Claudius would be granting him the mercy he didn’t deserve.
Though saddened by his father’s murder by his uncle, Claudius, Hamlet hesitates, and that is his tragic flaw.
The Freudian explanation is that Hamlet sees Claudius as a reflection of his most secret desires -being together with his mother. In other words, Claudius triggers Hamlet’s Oedipus complex and casts him into self-loathing. He sees himself as no better than his uncle who gets to experience his repressed Oedipal desires.