Perhaps we should consider the way Hamlet pursued revenge. He could have achieved revenge in a number of ways. He could have killed Claudius, and that’s the course he ended up taking, but he could also have revealed Claudius to the court. He could have revealed Claudius to Gertrude earlier in the play. He could also have forgiven. Any of those things would have fit better with his “morals”.
Yes, today you cannot take the law into your own hands. Even if you witnessed the murder of your father, you cannot straight away go and kill the murderer. No matter how justified you think you may be, you will be charged with murder and you will have to get yourself a lawyer and eventually stand trial or, at the very least, plea bargain. Being a Prince with a lot of money may help you, but there is no guarantee of an acquittal.
In Hamlet's day, and in the context of the play, I never thought that Prince Hamlet had a moral dilemma. Other people had seen the ghost of his father before he did; the ghost of Hamlet senior appears to his son and tells him he has been murdered and exhorts his son to exact revenge on the killer, his uncle, King Claudius. Hamlet is convinced right there on the battlements and knows what he has to do.
That it takes Prince Hamlet so long to do the necessary killing is not, in my opinion, because he has a moral or religious objection to doing so. It is because of his propensity for over-thinking a situation and dragging an action out with words that makes him delay. In the end, when he finally does get around to killing, Polonius' death is as simple and guiltless to Hamlet as is the death of Claudius.
Much of Hamlet's moral dilemma is based on the morality and immorality of revenge.
Hamlet is definitely a Christian. He has been raised to not take personal revenge: turn the other cheek and love your enemies.
Along comes his father's Ghost who turns Old Testament on his son, saying revenge me, an eye for an eye, blood vengeance.
Hamlet is morally very confused. Does he trust his father or heavenly father? Which heavenly father does he trust, Old Testament Yahweh or New Testament Jesus Christ?
Much of Hamlet's indecision in the play comes from moral confusion. Hamlet knows that committing the act of revenge will send him to hell. His famous "To be or not to be" monologue might very well be his pondering of whether or not to damn himself: "To be damned or not to be damned..."
Hamlet cannot kill Claudius at prayer: that would send his soul to heaven. So, he waits until it is proved that Claudius is a murderer (he poisons the cup that Gertrude drinks) before he takes action. Hamlet waits until he has already been morally wounded. In the end, Hamlet only commits revenge after he has been a victim of it. In this way, Hamlet wants to first send Claudius to hell, himself and his father's Ghost to heaven.
I would argue that revenge (especially to the extent of killing people) is not justified today in our developed societies. However, it is hard to condemn Hamlet's desire for revenge or indeed that of Fortinbras or Laertes.
In modern times, if someone kills your father, you can pretty much rely on the justice system to take revenge for you. It may not feel as good as taking revenge yourself, but it's legal.
For Hamlet, though, how else does one get revenge or, indeed, justice? Claudius is the most powerful man in the kingdom and there is no way to get justice for his murder of Hamlet's father. In such a case, personal revenge seems much more justified to me.