The first and most important crime that was committed in "Hamlet" is the killing of old King Hamlet by his own brother, Claudius. Claudius poured poison in his brother's ear while the old king slept in his garden. Claudius tells us in Act 3, sc. 3 that he committed this crime because he wanted the crown, he wanted Gertrude, and because he was ambitious. Those were his motivations and even he realizes that possessing them prevents him from getting salvation. He knows he's committed a mortal sin as well as a crime that would probably result in his own death. There is no upside to his motivation and no justification.
The next important crime is the killing of Polonius at Hamlet's hand in Act 3, sc. 4. Hamlet is highly incensed in this scene after the interrupted play. He has been called to his mother's room filled with the knowledge that his uncle, his mother's husband, killed his father. He does not understand why his mother married Claudius and now he is probably afraid that she might have had something to do with the death of her husband or at least, she should have been suspicious. Hamlet hears a noise behind the tapestry on the wall and stabs at it with his sword. As soon as Polonius's body falls to the ground, Hamlet asks, "Is it the king?" which seems to indicate that Hamlet thinks it was Claudius spying on them (never mind the fact that Hamlet has just left Claudius praying in the chapel). If Hamlet truly thought that the person behind the arras was Claudius, then his motivation was revenge. More likely, Hamlet didn't think before he stabbed the arras, he merely reacted - though this is in contrast to the slow acting and over-thinking character we see in the rest of the play. The justification, if there is one, is that Hamlet is distraught. He knows Claudius is a murderer and he knows he is supposed to get vengeance for his father and that he hasn't done as asked yet.
The final crimes all come out in the last scene of Act 5. Claudius and Laertes have planned to kill Hamlet with a poisoned and sharpened tip sword in a supposed friendly sword fighting match. Claudius lets Gertrude drink the poisoned wine with only a feeble attempt to stop her. His motivation is that he doesn't want to get caught trying to poison Hamlet and stopping Gertrude would expose what he's done. Laertes's motivation in wanting Hamlet dead is that he blames Hamlet not only for the death of his father, but also for Ophelia's death. Laertes has some justification for his motivation, but Claudius does not. Finally, there are the deaths of Rosencrantz and Guildenstern. Hamlet unsealed the orders Claudius sent with R and G and Hamlet on their thwarted trip to England. He found out the orders to the English were to put Hamlet to death. Hamlet rewrote the orders indicating the English were to put R and G to death. Hamlet justified this action by telling Horatio that R and G aligned themselves with Claudius, thus making them enemies of his.