By praying to God, Claudius is setting the truth free. He knows what he did was wrong, but still committed with his actions. Hamlet is beyond furious when he hears what he has known all along. Claudius is also being set free because we, the readers, foreshadow that Hamlet is going to kill him. Hamlet just has to wait for the right moment when Claudius is not in touch with God.
This is a lie! The whole thing is hard. It's hard to start when you know so little. It's hard to keep going when you've hit a road block. And it hard to get to the finish intact. But it will be worth it.