"You brought me this man as one who was misleading the people. and after examining him before you, behold, I did not find this man guilty..." Three times Pilate tried to reason with the irate crowd. He could not understand why the Jews would demand Jesus to be crucified when this man had done nothing deserving of death.
If Pilate had his way, Jesus would have been a free man. The significance of the Old Testament prophesies, of Jesus foretelling His death, of Jesus praying in the garden and of the symbolic Last Supper would be lost. The sovereignty of God directed every detail leading up to His birth, every detail of His life on this earth, and every detail leading up to His death.
Nothing thwarts the plan of God. An unjust punishment was given to an innocent man so that the guilty could be set free. Pilate gave Jesus the chance to be set free by allowing one prisoner to be let go. He gave the crowd the choice between Jesus and Barabbas who was an insurrectionist and a murderer. The crowd grew more urgent and they cried out in one loud voice that Jesus must be crucified.
They were right. Barabbas didn't deserve to be set free. In order for us who are all guilty of sin to be set free from God's wrath, which is the punishment we deserve, Jesus had to die for us. "It is rare indeed for anyone to die for a righteous man, though for a good man someone might possibly dare to die. But God proves His love for us in this: While we were still sinners, Christ died for us. Therefore, since we have now been justified by His blood, how much more shall we be saved from wrath through Him!" (Romans 5:7-9)