"So, if you seek me, let these men go.” 9 This was to fulfil the word that he had spoken: “Of those whom you gave me I have lost not one.” 10 Then Simon Peter, having a sword, drew it and struck the high priest's servant and cut off his right ear. (The servant's name was Malchus.) 11 So Jesus said to Peter, “Put your sword into its sheath; shall I not drink the cup that the Father has given me?”"
John 18:8b-11
There is another highly suggestive and instructive thought in 8b 'If therefore ye seek Me, let these go their way'. Few words could illustrate more clearly what is called the substitutionary aspect of our Lord's sufferings and death. Jesus expressly makes His capture the condition of His disciples' freedom. This alongside the idea of Christ as the mighty Victor, gives a broadly comprehensive picture of the meaning of the cross. Peter's action in attacking the high priest's servant was characteristically impulsive, but we can say something more about it than this: it was an irrelevancy. The more one thinks about it, the more one sees that it belonged to a different world from that in which Jesus was then operating. This was not how salvation was going to be accomplished, this was the arm of the flesh, and He was operating in a spiritual realm. The reference to the cup in 11b should be compared with the other three gospel writers' references to Gethsemane. There is no real contradiction between the two seemingly different viewpoints in Matthew, Mark and Luke, the cup is viewed as representing death as the wages of sin, the cup of the divine wrath, and it was from this that the Son of God shrank in the Garden, as He saw all the fateful implications of drinking it. In John, however, the cup represents the good and acceptable and perfect will of God, of which Jesus says, 'I delight to do Thy will'. And He was not prepared to allow Peter's sword, or anything else, to interfere with His embracing that will which was the passion of His life. All this we must read into the event which was His arrest by the soldiers in 12.