This happened so that the words Jesus had spoken indicating the kind of death he was going to die1 would be fulfilled.
References for John 18:32
Pilate then went back inside the palace,2 summoned Jesus and asked him, "Are you the king of the Jews?"3
References for John 18:33
"Is that your own idea," Jesus asked, "or did others talk to you about me?"
"Am I a Jew?" Pilate replied. "It was your people and your chief priests who handed you over to me. What is it you have done?"
Jesus said, "My kingdom4 is not of this world. If it were, my servants would fight to prevent my arrest by the Jews.5 But now my kingdom is from another place."6
References for John 18:36
"You are a king, then!" said Pilate. Jesus answered, "You are right in saying I am a king. In fact, for this reason I was born, and for this I came into the world, to testify to the truth.7 Everyone on the side of truth listens to me."8
References for John 18:37
"What is truth?" Pilate asked. With this he went out again to the Jews and said, "I find no basis for a charge against him.9
References for John 18:38
But it is your custom for me to release to you one prisoner at the time of the Passover. Do you want me to release 'the king of the Jews'?"
They shouted back, "No, not him! Give us Barabbas!" Now Barabbas had taken part in a rebellion.10
References for John 18:40